I have following markup for my nav-menu and menu icon to toggle it.
<a target='_blank' href="#navigation" class="toggle-menu">☰</a>
<nav id="navigation">
<a target='_blank' href="#" class="nav-item nav-blog active">Blog</a>
<a target='_blank' href="#" class="nav-item nav-projects">Projects</a>
<a target='_blank' href="#" class="nav-item nav-showcase">Showcase</a>
<a target='_blank' href="#" class="nav-item nav-social">Social</a>
<a target='_blank' href="#" class="nav-item nav-about">About</a>
<a target='_blank' href="#" class="nav-item nav-close">×</a>
</nav>
In which all menu items stack up vertically when viewing in Smartphone in portrait mode (I use CSS media queries).
Following is the initial style of menu items.
nav {
position: fixed;
top: 0;
padding-top: 60px;
}
nav .nav-item {
display: table;
margin-top: 10px;
padding: 2px 10px 2px 10px;
width: auto;
font-size: 2.5em;
text-align: left;
margin-left: -230px; /* Keep menu items off-screen by default. */
z-index: 1000;
-webkit-transition: margin-left 0.2s ease;
-moz-transition: margin-left 0.2s ease;
-o-transition: margin-left 0.2s ease;
transition: margin-left 0.2s ease;
}
/* Show Menu on :target or via JS */
nav:target .nav-item,
nav.open .nav-item {
margin-left: 0;
transition: margin-left 0.2s ease;
}
And now I toggle open
class on nav-menu upon click of a.toggle-menu
, this works fine and as expected in Chrome Canary 34 (DevTools device emulator) on Desktop, Firefox 26 running on Android 4.2, but it is giving unexpected behaviours in Chrome 31 on Android, as well as any other browser on Android (that uses WebView).
What's happening is when page is loaded for first time, and I tap on Menu icon, it shows Nav-menu with transition, and tapping again on Close hides it, but when I tap again the same menu icon, it doesn't show up, but if I double-tap on page (which usually zooms-in the page 1 level), nav-menu appears (without any transition, like it was already present there), and then tapping on close hides it, and this behaviour continues until I reload the page again.
Note that I'm currently using jQuery 2.0.3 for event handlers, and this problem persists with both ways of showing/hiding of menu, with JS, without JS.
Any help will be appreciated.
Try:
nav {
position: absolute;
top: 0;
padding-top: 60px;
}
nav .nav-item {
display: block;
margin-top: 10px;
padding: 2px 10px 2px 10px;
width: auto;
font-size: 2.5em;
text-align: left;
margin-left: -230px; /* Keep menu items off-screen by default. */
z-index: 1000;
-webkit-transition: margin-left 0.2s ease;
-moz-transition: margin-left 0.2s ease;
-o-transition: margin-left 0.2s ease;
transition: margin-left 0.2s ease;
}
/* Show Menu on :target or via JS */
nav:target .nav-item,
nav.open .nav-item {
margin-left: 0 !important;
}
I have this code on my jquery participantText += '<div class="wrap_col td7"><input type="image" src="/pc/images/callgray.png" style="vertical-align: middle" class="actionInvite"></div&...
I have this code on my jquery participantText += '<div class="wrap_col td7"><input type="image" src="/pc/images/callgray.png" style="vertical-align: middle" class="actionInvite"></div&...
In traditional code I will pass arguments to link button like this: <a href="javascript:call_hello(1, 2, 3)" role="button">Hello</a> How can I do it in unobtrusive JavaScript style with ...
In traditional code I will pass arguments to link button like this: <a href="javascript:call_hello(1, 2, 3)" role="button">Hello</a> How can I do it in unobtrusive JavaScript style with ...
i am trying to creat a carousel animation that take 3 pics and slide the to the left and bring new 3 images, i don't think i'm in the right direction need help here is the fiddle link: http://...
i am trying to creat a carousel animation that take 3 pics and slide the to the left and bring new 3 images, i don't think i'm in the right direction need help here is the fiddle link: http://...
I have a html string var str = '<span class="linq" onclick="ShowData(2,-1,1);">11111</span> » <span class="linq" onclick="ShowData(16,1,1);">22222</span> &...
I have a html string var str = '<span class="linq" onclick="ShowData(2,-1,1);">11111</span> » <span class="linq" onclick="ShowData(16,1,1);">22222</span> &...