solo-third-skins/skins/dashu03/js/bootstrap-tab.min.js
2019-03-16 19:01:27 +08:00

1 line
1.2 KiB
JavaScript

!function(o){"use strict";var n=function(t){this.element=o(t)};n.prototype={constructor:n,show:function(){var t,a,e,n=this.element,i=n.closest("ul:not(.dropdown-menu)"),s=n.attr("data-target");s||(s=(s=n.attr("href"))&&s.replace(/.*(?=#[^\s]*$)/,"")),n.parent("li").hasClass("active")||(t=i.find(".active:last a")[0],e=o.Event("show",{relatedTarget:t}),n.trigger(e),e.isDefaultPrevented()||(a=o(s),this.activate(n.parent("li"),i),this.activate(a,a.parent(),function(){n.trigger({type:"shown",relatedTarget:t})})))},activate:function(t,a,e){var n=a.find("> .active"),i=e&&o.support.transition&&n.hasClass("fade");function s(){n.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),i?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),e&&e()}i?n.one(o.support.transition.end,s):s(),n.removeClass("in")}},o.fn.tab=function(e){return this.each(function(){var t=o(this),a=t.data("tab");a||t.data("tab",a=new n(this)),"string"==typeof e&&a[e]()})},o.fn.tab.Constructor=n,o(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),o(this).tab("show")})}(window.jQuery);