Created
March 31, 2017 12:44
-
-
Save Burick/0902f9e54838c8ae6bd4757fad918238 to your computer and use it in GitHub Desktop.
Bootstrap hover
This file contains hidden or 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
$(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