Faster Twitter Bootstrap Mobile Navigation
I have noticed that there is a half second or so delay between when you touch the .navbar-toggle and when the dropdown menu flies out.
This short delay might relate to how mobile browsers detect a click()
. It seems that binding touchstart()
to .navbar-toggle
does the trick.
$(document).ready(function(){
$('.navbar-toggle').bind( "touchstart", function(e){
e.preventDefault();
$('.navbar-collapse').collapse('toggle');
});
});
It's important to note that touchstart()
will interfere with mobile scrolling, so if your "hamburger" or .navbar-toggle
target is larger than default it might be better to avoid this patch.
Written by &y
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mobile
Authors
Related Tags
#mobile
#dropdown
#twitter bootstrap
#animation
#touch
#jquery
#delay
#navbar-collpase
#navbar-toggle
#hamburger
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#