I'm beginning a web app using Materialize CSS v0.97, jQuery Mobile v1.4.5, and jQuery v2.1.4.
I'm trying to use the mobile collapse tutorial to have a navbar in the jQuery Mobile header, which on mobile devices changes to a hamburger button with the menu appearing when clicked.
When I resize my browser (Chrome, latest on Mac v10.11) to mobile size, the hamburger appears but clicking or hovering or anything does not make the menu appear.
The only thing I have changed was commenting out a line in jQuery Mobile JS because of this post about how to fix the Chrome security warning.
Could that be why the nav bar isn't working? My site doesn't load at all with the below code because of that warning, so I have everything js and css saved locally with relative links to them. But this snippet worked in the snippet preview...
$( document ).ready(function(){
$(".button-collapse").sideNav();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<link href="https://code.jquery.com/mobile/1.4.5/jquery.mobile.structure-1.4.5.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/js/materialize.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<body>
<div data-role="page" id="home">
<div data-role="header">
<nav>
<div class="nav-wrapper">
Logo
<i class="material-icons">menu</i>
<ul class="right hide-on-med-and-down">
<li>Sass</li>
<li>Components</li>
<li>Javascript</li>
<li>Mobile</li>
</ul>
<ul class="side-nav" id="mobile-demo">
<li>Sass</li>
<li>Components</li>
<li>Javascript</li>
<li>Mobile</li>
</ul>
</div>
</nav>
</div>
<!-- /header -->
<div role="main" class="ui-content">
<table class="centered">
<thead>
<tr>
<th data-field="collection">Collection</th>
<th data-field="description"></th>
<th data-field="progress"></th>
<th data-field="link"></th>
</tr>
</thead>
<tbody>
<tr>
<td>Stuff 1</td>
<td>Description of things in Stuff 1. Stuff 1 is really great, ya know? So much stuff in it.</td>
<td></td>
<td><i class="material-icons">chevron_right</i></td>
</tr>
<tr>
<td>Stuff 2</td>
<td>Description of things in Stuff 2. Stuff 2 is really great, ya know? So much stuff in it.</td>
<td></td>
<td><i class="material-icons">chevron_right</i></td>
</tr>
<tr>
<td>Stuff 3</td>
<td>Description of things in Stuff 3. Stuff 3 is really great, ya know? So much stuff in it.</td>
<td></td>
<td><i class="material-icons">chevron_right</i></td>
</tr>
</tbody>
</table>
</div>
<!-- /content -->
</div>
<!-- /page -->
</body>
Such is life -- as soon as I complain, the next thing I try works.
I kept the above code and only changed the jQuery Mobile import to point to the local, edited version, and now it runs in Chrome and the menu works.
Most likely something's messed up with me localizing the rest of the dependancies, but for now I'm good.
Related
I have implemented JQuery UI Datepicker on a site.
I have an issue where that when I click to show the calendar dropdown, where the dropdown overlays the bootstrap card in the next row, anything over the card-header cannot be clicked on.
If I scroll the page, the calendar position remains static, but the non-clickable area moves to wherever the card-header is positioned.
The z-index of the calendar is 9999, whilst that of the card-header is only 3.
I have tried adding
style="overflow: visible !important"
to the card based on another answer on stackoverflow, but no dice.
I have screenshot rendered html below, marking the datepicker, and the overlaid card-header:
In case relevant, I am using:
Bootstrap 4.6
ASP.NET Webforms
Material Dashboard 2.1.0
JQuery UI 1.13.2
JQuery 3.6.0
Any ideas why this is happening, and how to resolve? Thanks.
Edit 1 - 2023-01-11
I have put up a minimal example Here
I have added an inline style to the card-header that is being overlaid to increase the height, so that the problem is more apparent.
(I have stripped out a load of script references for this example that are now causing a few console errors, but these are not related to the issue.)
I am unable to replicate your code as it has links to content that is local to your web site. Consider the following more basic example.
$(function() {
$(".datepicker").datepicker({
dateFormat: 'dd/mm/yy'
});
});
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/smoothness/jquery-ui.css">
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
<div class="row">
<div class="col-md-12">
<div class="card z-index-2 mt-0 h-100">
<div class="card-header">
<h4>Card with Datepicker</h4>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-sm table-borderless mb-0">
<tbody>
<tr>
<th class="pl-0 w-50 pt-1 pb-1 border-top-0" scope="row"><strong>Select Date</strong></th>
<td class="pt-1 pb-1">
<span class="bmd-form-group is-filled"><input name="LastContactedCal" type="text" id="LastContactedCal" class="datepicker form-control" value="05/10/2022"></span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card z-index-2 mt-0 h-100">
<div class="card-header" style="height: 200px;">
<h4>Another Card</h4>
</div>
<div class="card-body">
<p>Some Stuff</p>
</div>
</div>
</div>
</div>
This works as expected without the issue that you reported. I suspect that some other component that my example is not using is interfering with the click event in your sites code. I would suggest you remove all additional libraries except for Bootstrap and jQuery UI, then add them back in one at a time or in other orders, to see when the functionality you are seeing returns.
I am new to Grails and I am trying to get a template navigation bar to be populated dynamically through a controller. I am really close to solving this but seem to have run into a wall lately.
I currently am getting the navigation to populate only when I click on the link for that controller. Every where else the navigation just populates the bullet points for the links. I am probably not referencing the controller correctly in my template but have not found any good examples yet.
using Grails 2.3.3
the controllers are dynamic.
Here is the code for my navigation template
<body>
<!-- Links to the committees go here -->
<div class="leftMenu">
<!-- template of hospitals and there committees goes here -->
<div>
<g:render template="/hospital/committeeTemp" />
</div>
<tr valign="top">
<td>
<a href="index.jsp?nav=main&hosp=<%=hospGiven %>" target="_top">
<img src="/Trustees/static/images/img/navigate.events.gif" border="0">
</a>
</td>
</tr>
<tr valign="top">
<td>
<a href="index.jsp?nav=main&hosp=<%=hospGiven %>" target="_top">
<img src="/Trustees/static/images/img/navigate.news.gif" border="0">
</a>
</td>
</tr>
<tr valign="top">
<td>
<a href="index.jsp?nav=main&hosp=<%=hospGiven %>" target="_top">
<img src="/Trustees/static/images/img/navigate.help.gif" border="0">
</a>
</td>
</tr>
<%-- </table>--%>
</div>
</body>
I am using a nested loop to populate the navigation bar. That code can be found here Grails navigation links nested loop
With a little more knowledge under my belt. I found out that it was only populating on that one page because that is where it was accessing that particular controller's action. So I ended up putting that mapping into ever action in my controller.
I'm completely new to jQuery Mobile and just trying to get a feel for how it might to work in my environment.
One Page 1 I'm displaying values that come down from the server. What I want to do is go to Page2 to set the values and then pressing "Back" have page 1 show the updated values.
Currently when I hit back, it's showing the original values and I need to do a manual partial or full refresh to get them updated.
How can I tell jQuery Mobile to auto refresh a page on hitting the back button? I'm using data-rel="back".
I guess I'm looking to see if there's a universal setting for this or something. Similar to $.mobile.ajaxEnabled = false; which I needed to turn on in my environment to get things working.
Thanks
UPDATE:
I've added some code here per request. Not sure it will really help. But here's what's going on. I'm trying to use jQuery Mobile in the context of an IBM XPages application. XPages is basically Java Server Faces but it has Dojo 1.8.1 built into it do to certain things like a Partial Refresh of a Div automatically. So for instance on a button I can write server side code - int a Java Managed Bean, get a result, and have it partial refresh a div on the webpage. Cool stuff. But the problem I GUESS is conflicts between jQuery Mobile and the build in Dojo that makes those things work. I don't want to use the mobile portion of Dojo because jQuery seems so much better.
Anyway - I got jQuery Mobile to work by making sure it loaded BEFORE the dojo pieces loaded. The other way around it wouldn't work at all. I'd like to work with individual pages rather then virtual pages in one.
I'm not sure if I care about much caching really as the pages will almost always be changing. I'm working on an inventory application with iPads and barcode scanners. So for instance on page1 I scan an item. Then I might move to page 2 to let the user do something with the item, on hitting the back button I want page 1 to refresh so it's updated with any new information
Thanks for any advice!!!
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="/xsp/.ibmxspres/.mini/css/#Da&#Ib&2Tfxsp.css&2TfxspLTR.css&2TfxspSF.css.css">
<script type="text/javascript" src="/xsp/.ibmxspres/dojoroot-1.8.1/dojo/dojo.js" djConfig="locale: 'en-us'"></script>
<script type="text/javascript" src="/xsp/.ibmxspres/.mini/dojo/.en-us/#Iq.js"></script>
<script type="text/javascript">dojo.require('ibm.xsp.widget.layout.xspClientDojo')</script>
<link rel="stylesheet" type="text/css" href="/jqm.nsf/themes/czarnowskiMobile.min.css">
</head>
<body class="xspView tundra">
<form id="view:_id1" method="post" action="/jqm.nsf/home.xsp" class="xspForm" enctype="multipart/form-data">
<div data-role="page" data-theme="b">
<div data-role="header">
<h1><span id="view:_id1:_id2:computedField1" class="xspTextComputedField">Scanner</span></h1></div>
<div data-role="content">
<div id="view:_id1:_id2:callback3">
<ul data-role="listview"><li><a id="view:_id1:_id2:callback3:link2" href="/jqm.nsf/menuFacility.xsp" class="xspLink">Facility Menu</a></li><li><a id="view:_id1:_id2:callback3:link3" href="/jqm.nsf/menuShow.xsp" class="xspLink">Show Menu</a></li></ul><br><div id="view:_id1:_id2:callback3:_id12:timePanel">
<table><tr><td><span id="view:_id1:_id2:callback3:_id12:label1" class="xspTextLabel">viewScope</span></td>
<td><span id="view:_id1:_id2:callback3:_id12:computedField1" class="xspTextComputedField"></span></td>
<td><button class="xspButtonCommand" type="button" name="view:_id1:_id2:callback3:_id12:button1" id="view:_id1:_id2:callback3:_id12:button1" data-role="none">Update</button></td>
<td><button class="xspButtonCommand" type="button" name="view:_id1:_id2:callback3:_id12:button3" id="view:_id1:_id2:callback3:_id12:button3" data-role="none">Clear</button></td>
</tr>
<tr><td><span id="view:_id1:_id2:callback3:_id12:label2" class="xspTextLabel">sessionScope</span></td>
<td><span id="view:_id1:_id2:callback3:_id12:computedField2" class="xspTextComputedField"></span></td>
<td><button class="xspButtonCommand" type="button" name="view:_id1:_id2:callback3:_id12:button2" id="view:_id1:_id2:callback3:_id12:button2" data-role="none">Update</button></td>
<td><button class="xspButtonCommand" type="button" name="view:_id1:_id2:callback3:_id12:button4" id="view:_id1:_id2:callback3:_id12:button4" data-role="none">Clear</button></td>
</tr>
<tr><td>Current Time</td>
<td><span id="view:_id1:_id2:callback3:_id12:computedField3" class="xspTextComputedField">7:39:40 PM</span></td>
<td></td>
<td></td>
</tr>
<tr><td><button class="xspButtonCommand" type="button" name="view:_id1:_id2:callback3:_id12:button5" id="view:_id1:_id2:callback3:_id12:button5" data-role="none">Partial Refresh</button></td>
<td><button class="xspButtonCommand" type="button" name="view:_id1:_id2:callback3:_id12:button6" id="view:_id1:_id2:callback3:_id12:button6" data-role="none">Full Refresh</button></td>
<td></td>
<td></td>
</tr>
<tr><td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</div>
</div>
</div>
<div data-role="footer" data-position="fixed">
<div id="view:_id1:_id2:callback2">
Footer Test</div>
</div>
</div>
<script> $.mobile.ajaxEnabled = false;
$.mobile.pushStateEnabled = false;</script>
<input type="hidden" name="$$viewid" id="view:_id1__VUID" value="!dgljtbhtgw!">
<input type="hidden" name="$$xspsubmitid">
<input type="hidden" name="$$xspexecid">
<input type="hidden" name="$$xspsubmitvalue">
<input type="hidden" name="$$xspsubmitscroll">
<input type="hidden" name="view:_id1" value="view:_id1"></form>
<script type="text/javascript">
XSP.addOnLoad(function() {
XSP.attachPartial("view:_id1:_id2:callback3:_id12:eventHandler1", "view:_id1:_id2:callback3:_id12:button1", null, "onclick", function(){}, 2, "view:_id1:_id2:callback3:_id12:timePanel");
XSP.attachPartial("view:_id1:_id2:callback3:_id12:eventHandler3", "view:_id1:_id2:callback3:_id12:button3", null, "onclick", function(){}, 2, "view:_id1:_id2:callback3:_id12:timePanel");
XSP.attachPartial("view:_id1:_id2:callback3:_id12:eventHandler2", "view:_id1:_id2:callback3:_id12:button2", null, "onclick", function(){}, 2, "view:_id1:_id2:callback3:_id12:timePanel");
XSP.attachPartial("view:_id1:_id2:callback3:_id12:eventHandler4", "view:_id1:_id2:callback3:_id12:button4", null, "onclick", function(){}, 2, "view:_id1:_id2:callback3:_id12:timePanel");
XSP.attachPartial("view:_id1:_id2:callback3:_id12:_id32", "view:_id1:_id2:callback3:_id12:button5", null, "onclick", function(){}, 2, "view:_id1:_id2:callback3:_id12:timePanel");
XSP.attachEvent("view:_id1:_id2:callback3:_id12:_id34", "view:_id1:_id2:callback3:_id12:button6", "onclick", null, true, 2);
});
</script>
</body>
</html>
I'm using the twitter boot-strap library within groovy grails and can currently get both modals and dropdowns to work, but not one inside the other. Here's the code I'm writing, it's so close, when I click on something inside of the dropdown, a psuedo modal shows up, it turns the screen black (transparency included in modals) but doesn't display the box with the info I supplied. Also I've noticed upon further inspection with firebug that only the first set of modals are made but the rest aren't, I'm confused why this is the case. Can anyone help?
Code:
<table>
<thead>
<tr>
<g:sortableColumn property="name" title="${message(code: 'course.name.label', default: 'Name')}" />
<g:sortableColumn property="description" title="${message(code: 'course.description.label', default: 'Description')}" />
</tr>
</thead>
<tbody>
<g:each in="${courseInstanceList}" status="i" var="courseInstance">
<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
<td>
<ul class="nav nav-pills">
<li class="dropdown" id="menu${courseInstance.id}">
<a class="dropdown-toggle" data-toggle="dropdown" href="#menu${courseInstance.id}">
${courseInstance.name}
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<g:each in="${courseInstance.hasMany}" var="param">
<a data-toggle="modal", href="#myModal${courseInstance.id}${param.getProperties().key}", id="${courseInstance.id}${param.getProperties().key}">${param.getProperties().key}</a>
<div class="modal" id="myModal${courseInstance.id}${param.getProperties().key}">
<div class="modal-header">
<a class="close" data-dismiss="modal">x</a>
<h3>Students in ${courseInstance.name}</h3>
</div>
<div class="modal-body">
<g:javascript>
$('#myModal${courseInstance.id}${param.getProperties().key}').modal({
keyboard: true
})
$('#myModal${courseInstance.id}${param.getProperties().key}').modal('hide')
</g:javascript>
</div>
<div class="modal-footer">
Close
Save changes
</div>
</div>
</li>
</g:each>
</td>
<td>${fieldValue(bean: courseInstance, field: "description")}</td>
</tr>
</g:each>
</tbody>
</table>
There is a missing <li> element between the g:each and the a reference...but this should not be the point.
I'am using bootstrap with grails too, and I also use a modal within a navbar dropdown button, it works (but takes me several hours...).
I dont know for sure that it matters but i render the modal template outside of the dropdown. I also set the javascript to "modalize" the dialog below the modal div (not inside the modal-body).
Are you sure that everywhere the expression: myModal${courseInstance.id}${param.getProperties().key} is evaluated to same?
Also make sure that you dont import the modal.js manually (it is already imported in bootstrap.js). This caused some weird behaviour.
I'm using <div class="modal hide fade" id="..."> for the modal. This auto hides the div and adds some nice fade transitions (requires transitions.js).
Then the code reduces to: $('#...').modal({
keyboard: true,
show : false
})
Maybe some of these tips helps...
M.
As you can see here: http://jsfiddle.net/kralco626/3BYDu/
The icon does not show up when you use display:inline
How do I get around this?
Useui-icon, before of the ui-icon-ICON and use the CSS display:inline-block should work properly
<span class="ui-icon ui-icon-home" style="display: inline-block"/>
<table>
<thead>
<th>
<div style="float:left">My Header</div>
<div style="float:left" class="ui-icon ui-icon-triangle-1-n"></div>
</th>
</thead>
</table>
Edit for formatting.
Well, I guess you could try inline-block instead of inline.