Skip to content

Instantly share code, notes, and snippets.

@Burick
Created March 31, 2017 12:44
Show Gist options
  • Save Burick/0902f9e54838c8ae6bd4757fad918238 to your computer and use it in GitHub Desktop.
Save Burick/0902f9e54838c8ae6bd4757fad918238 to your computer and use it in GitHub Desktop.
Bootstrap hover
$(function(){
'use strict';
const dh = $('[data-hover="true"]');
dh.hover(
function(e) {
$(this).parent().addClass('open');
}, function(e) {
$('.open [data-hover="true"] + .dropdown-menu').hover(
function(e){
},
function(e){
dh.parent().removeClass('open');
dh.hover(
function(e){
},
function(e){
$(this).parent().removeClass('open');
}
);
}
);
});
dh.click(function(){
window.location = this.href;
});
});
////////////////
$("#main-menu ul.nav>li.dropdown").on("mouseover", function () {
$(this).addClass("open")
}).on("mouseleave", function () {
$(this).removeClass("open")
}).on("click", ">a", function () {
window.location = this.href;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment