(function($){$.fn.dropit=function(method){var methods={init:function(options){this.dropit.settings=$.extend({},this.dropit.defaults,options);return this.each(function(){var $el=$(this),el=this,settings=$.fn.dropit.settings;$el.on(settings.action,settings.this,function(){if($(this).hasClass('active-drop')){$(this).removeClass('active-drop');return!1}
settings.beforeHide.call(this);$('.active-drop').removeClass('active-drop');settings.afterHide.call(this);settings.beforeShow.call(this);$(this).addClass('active-drop');settings.afterShow.call(this);var url=$(this).attr('href');return!1});$(document).on('click',function(){settings.beforeHide.call(this);$('.active-drop').removeClass('active-drop').find('.dropit-submenu').hide();settings.afterHide.call(this)});settings.afterLoad.call(this)})}}
if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof method==='object'||!method){return methods.init.apply(this,arguments)}else{$.error('Method "'+method+'" does not exist in dropit plugin!')}}
$.fn.dropit.defaults={action:'click',submenuEl:'ul',triggerEl:'a',triggerParentEl:'li',afterLoad:function(){},beforeShow:function(){},afterShow:function(){},beforeHide:function(){},afterHide:function(){}}
$.fn.dropit.settings={}})(jQuery)