I am working on a website and I have a problem with the navigation drop downs using tablets. I have tried using Modernizr using no-touch events and had no luck.
The issue is that on Android tablets when click on the navigation drop-downs it loads the parent page rather than holding the drop-down. I came across this fix http://osvaldas.info/drop-down-navigation-responsive-and-touch-friendly and it fixed the issue on Android tablets but it triggered two-three taps using the iOs tablets on navigation.
Code that fixed Android issue:
<script>
/*
AUTHOR: Osvaldas Valutis, www.osvaldas.info
*/
;(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 );</script>
And this: <script>
$( function() { $( '#second-menu li:has(ul)' ).doubleTapToGo(); }); </script>
The website that I am working on is www.bpcdev.co.uk for your inspection. Please if you could let me know if there are any more fixes available for iOS two - three taps on navigation drop - downs. Thanks in advanced! :)