-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhoverifyBootnav.min.js
More file actions
1 lines (1 loc) · 2.9 KB
/
Copy pathhoverifyBootnav.min.js
File metadata and controls
1 lines (1 loc) · 2.9 KB
1
!function(o){o.fn.hoverifyBootnav=function(t){var e=o.extend({duration_effect_on:200,duration_effect_off:500,easing_effect_on:null,easing_effect_off:null,effect_mouse_hover:"classic",effect_mouse_out:"classic",background_color:null,color:null,my_effect_mouse_hover:null,my_effect_mouse_out:null},t);if(0===this.length)return this;if(this.length>1)return this.each(function(){o(this).hoverifyBootnav(t)}),this;var i=this;if(!o(i).data("hoverboot")&&0!=i.find("li.active").length){var n=function(){f(),s(),c()},a=function(o){o.hasClass("nav-tabs")?o.addClass("hoverboot-cadre"):o.hasClass("nav-pills")?o.addClass("hoverboot-pills"):o.addClass("hoverboot-pills")},s=function(){i.addClass("hoverboot");var o=i.find("li.active");i.wrap("<div class='hoverboot-wrap'></div>");var t=i.closest(".hoverboot-wrap");t.append("<div class='hoverboot-pill'></div>");var n=t.find(".hoverboot-pill");n.css("background-color",e.background_color),a(i),n.width(o.width()),n.height(o.height()),n.css({left:o.position().left,top:o.position().top})},f=function(){var t=i.data("hbn-options");t&&(e=o.extend(e,t))},c=function(){i.find("> li").hover(function(){if(null!==e.my_effect_mouse_hover)e.my_effect_mouse_hover();else switch(e.effect_mouse_hover){case"classic":l(o(this));break;case"teleportation":h(o(this));break;default:l(o(this))}},function(){if(null!==e.my_effect_mouse_out)e.my_effect_mouse_out();else switch(e.effect_mouse_out){case"classic":r(o(this));break;case"teleportation":u(o(this));break;default:r(o(this))}})},l=function(o){var t=o.closest(".hoverboot-wrap").find(".hoverboot-pill");t.stop().animate({width:o.width(),left:o.position().left,top:o.position().top},{duration:e.duration_effect_on,easing:e.easing_effect_on,complete:function(){o.find("> a").css("color",e.color)}})},r=function(o){var t=o.closest(".hoverboot-wrap").find(".hoverboot-pill"),i=o.closest(".hoverboot-wrap").find("ul>li.active");o.find("> a").css("color",""),t.stop().animate({width:i.width(),left:i.position().left,top:i.position().top},{duration:e.duration_effect_off,easing:e.easing_effect_off})},h=function(o){var t=o.closest(".hoverboot-wrap").find(".hoverboot-pill");t.stop().animate({opacity:0},{duration:e.duration_effect_on/2,complete:function(){t.css({top:o.position().top,width:0,left:o.position().left+o.width()/2}),t.animate({opacity:1,width:o.width(),left:o.position().left},{duration:e.duration_effect_on/2})}})},u=function(o){var t=o.closest(".hoverboot-wrap").find(".hoverboot-pill"),i=o.closest(".hoverboot-wrap").find("ul>li.active");o.find("> a").css("color",""),t.stop().animate({opacity:0},{duration:e.duration_effect_on/2,complete:function(){t.css({opacity:1,width:0,left:i.position().left+i.width()/2,top:i.position().top}),t.animate({opacity:1,left:i.position().left,width:i.width()},{duration:e.duration_effect_on/2})}})};return n(),this}};var t=function(){o("*[data-hbn]").each(function(){var t=o(this).data("hbn-options");o(this).hoverifyBootnav(t)})};t()}(jQuery);