1; (function($, window, document, undefined) { 2 var pluginName = "jqueryAccordionMenu"; 3 var defaults = { 4 speed: 300, 5 showDelay: 0, 6 hideDelay: 0, 7 singleOpen: true, 8 clickEffect: true 9 }; 10 function Plugin(element, options) { 11 this.element = element; 12 this.settings = $.extend({}, 13 defaults, options); 14 this._defaults = defaults; 15 this._name = pluginName; 16 this.init() 17 }; 18 $.extend(Plugin.prototype, { 19 init: function() { 20 this.openSubmenu(); 21 this.submenuIndicators(); 22 if (defaults.clickEffect) { 23 this.addClickEffect() 24 } 25 }, 26 openSubmenu: function() { 27 $(this.element).children("ul").find("li").bind("click", 28 function(e) { 29 e.stopPropagation(); 30 //e.preventDefault(); 31 if ($(this).children(".submenu").length > 0) { 32 if ($(this).children(".submenu").css("display") == "none") { 33 $(this).children(".submenu").delay(defaults.showDelay).slideDown(defaults.speed); 34 $(this).children(".submenu").siblings("a").addClass("submenu-indicator-minus"); 35 if (defaults.singleOpen) { 36 $(this).siblings().children(".submenu").slideUp(defaults.speed); 37 $(this).siblings().children(".submenu").siblings("a").removeClass("submenu-indicator-minus") 38 } 39 return false 40 } else { 41 $(this).children(".submenu").delay(defaults.hideDelay).slideUp(defaults.speed) 42 } 43 if ($(this).children(".submenu").siblings("a").hasClass("submenu-indicator-minus")) { 44 $(this).children(".submenu").siblings("a").removeClass("submenu-indicator-minus") 45 } 46 } 47 //window.location.href = $(this).children("a").attr("href") 48 }) 49 }, 50 submenuIndicators: function() { 51 if ($(this.element).find(".submenu").length > 0) { 52 //$(this.element).find(".submenu").siblings("a").append("<span class='submenu-indicator'>+</span>") 53 $(this.element).find(".submenu").siblings("a").append("<span class='submenu-indicator'><i class='ri-arrow-down-s-line'></i></span>") 54 } 55 }, 56 addClickEffect: function() { 57 var ink, d, x, y; 58 $(this.element).find("a").bind("click", 59 function(e) { 60 $(".ink").remove(); 61 if ($(this).children(".ink").length === 0) { 62 $(this).prepend("<span class='ink'></span>") 63 } 64 ink = $(this).find(".ink"); 65 ink.removeClass("animate-ink"); 66 if (!ink.height() && !ink.width()) { 67 d = Math.max($(this).outerWidth(), $(this).outerHeight()); 68 ink.css({ 69 height: d, 70 width: d 71 }) 72 } 73 x = e.pageX - $(this).offset().left - ink.width() / 2; 74 y = e.pageY - $(this).offset().top - ink.height() / 2; 75 ink.css({ 76 top: y + 'px', 77 left: x + 'px' 78 }).addClass("animate-ink") 79 }) 80 } 81 }); 82 $.fn[pluginName] = function(options) { 83 this.each(function() { 84 if (!$.data(this, "plugin_" + pluginName)) { 85 $.data(this, "plugin_" + pluginName, new Plugin(this, options)) 86 } 87 }); 88 return this 89 } 90})(jQuery, window, document);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.