Last active
December 1, 2017 08:10
-
-
Save AlexeyKuzmich/13c4f282f9c7bc97774b8639c072b4f5 to your computer and use it in GitHub Desktop.
Bootstrap nav menu hack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Bootstrap nav menu hack | |
*/ | |
$(window).on('load', function () { | |
// On page load | |
if ($(window).width() < 768) { | |
$('.navbar-nav > li > .dropdown-toggle').removeAttr('data-hover').attr('data-toggle', 'dropdown'); | |
} | |
// On window resize | |
$(window).resize(function () { | |
if ($(window).width() < 768) { | |
$('.navbar-nav > li > .dropdown-toggle').removeAttr('data-hover').attr('data-toggle', 'dropdown'); | |
} else { | |
$('.navbar-nav > li > .dropdown-toggle').removeAttr('data-toggle').attr('data-hover', 'dropdown'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment