/** * project: bootstrap hover dropdown * author: cameron spear * contributors: mattia larentis * * dependencies: bootstrap's dropdown plugin, jquery * * a simple plugin to enable bootstrap dropdowns to active on hover and provide a nice user experience. * * license: mit * * http://cameronspear.com/blog/bootstrap-dropdown-on-hover-plugin/ */(function(b,a,c){var d=b();b.fn.dropdownhover=function(e){if("ontouchstart" in document){return this}d=d.add(this.parent());return this.each(function(){var m=b(this),l=m.parent(),k={delay:500,instantlycloseothers:true},i={delay:b(this).data("delay"),instantlycloseothers:b(this).data("close-others")},f="show.bs.dropdown",j="hide.bs.dropdown",g=b.extend(true,{},k,e,i),h;l.hover(function(n){if(!l.hasclass("open")&&!m.is(n.target)){return true}d.find(":focus").blur();if(g.instantlycloseothers===true){d.removeclass("open")}a.cleartimeout(h);l.addclass("open");m.trigger(f)},function(){h=a.settimeout(function(){l.removeclass("open");m.trigger(j)},g.delay)});m.hover(function(){d.find(":focus").blur();if(g.instantlycloseothers===true){d.removeclass("open")}a.cleartimeout(h);l.addclass("open");m.trigger(f)});l.find(".dropdown-submenu").each(function(){var o=b(this);var n;o.hover(function(){a.cleartimeout(n);o.children(".dropdown-menu").show();o.siblings().children(".dropdown-menu").hide()},function(){var p=o.children(".dropdown-menu");n=a.settimeout(function(){p.hide()},g.delay)})})})};b(document).ready(function(){b('[data-hover="dropdown"]').dropdownhover()})})(jquery,this);