Okay this is the deal, I'm a student working on my final website for class and we need to have some javascript/jquery in our site. I didn't want to get to crazy so I just settled for a drop down menu for mobile devices. My only problem is if I link a page in my tutorials button of my navigation it automatically goes to that page ans doesn't allow me to tap tutorials again. I hope that makes sense, please let me know if it doesn't. My navigation mark up is...
<nav role="navigation" aria-label="Main menu">
<ul role="menubar">
<li role="menuitem" tabindex="0"><a href="index.html" class="mainmenu">Home</a></li>
<li class="mainmenu" role="menuitem" aria-haspopup=true tabindex="0"><a href="production.html" class="mainmenu">Tutorials</a>
<ul class="submenu" role="menu" aria-hidden=true>
<li role="menuitem" tabindex="-1"><a href="pre-pro.html">Pre-Production</a></li>
<li role="menuitem" tabindex="-1"><a href="production.html">Production</a></li>
<li role="menuitem" tabindex="-1"><a href="post.html">Post</a></li>
</ul>
</li>
<li role="menuitem" tabindex="0"><a href="films.html" class="mainmenu">Films</a></li>
</ul>
</nav>
The JQuery Plugin I found is the following...
;(function( $, window, document, undefined )
{
$.fn.doubleTapToGo = function( params )
{
if( !( 'ontouchstart' in window ) &&
!navigator.msMaxTouchPoints &&
!navigator.userAgent.toLowerCase().match( /windows phone os 7/i ) ) return false;
this.each( function()
{
var curItem = false;
$( this ).on( 'click', function( e )
{
var item = $( this );
if( item[ 0 ] != curItem[ 0 ] )
{
e.preventDefault();
curItem = item;
}
});
$( document ).on( 'click touchstart MSPointerDown', function( e )
{
var resetItem = true,
parents = $( e.target ).parents();
for( var i = 0; i < parents.length; i++ )
if( parents[ i ] == curItem[ 0 ] )
resetItem = false;
if( resetItem )
curItem = false;
});
});
return this;
};
})( jQuery, window, document );
and this is where I had found the plugin http://osvaldas.info/drop-down-navigation-responsive-and-touch-friendly in case you want something to reference. Thank you for any help in advance. Cheers!
From the source of the example page:
<script>
$( function()
{
$( '#nav li:has(ul)' ).doubleTapToGo();
});
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.