diff --git a/dist/zeynep.css b/dist/zeynep.css index a493695..d0db8be 100644 --- a/dist/zeynep.css +++ b/dist/zeynep.css @@ -1,5 +1,5 @@ /*! -* zeynepjs v2.1.4 +* zeynepjs v2.2.0 * A light-weight multi-level jQuery side menu plugin. * It's fully customizable and is compatible with modern browsers such as Google Chrome, Mozilla Firefox, Safari, Edge and Internet Explorer * MIT License @@ -13,7 +13,7 @@ pointer-events:none; position:fixed; top:0; - transform:translateX(-100%); + transform:translateX(-100%) translateZ(0px); z-index:1011; } @@ -39,7 +39,7 @@ .zeynep.opened{ pointer-events:auto; - transform:translateX(0px); + transform:translateX(0px) translateZ(0px); } .zeynep.submenu-opened{ diff --git a/dist/zeynep.js b/dist/zeynep.js index df8b205..bf8d3e8 100644 --- a/dist/zeynep.js +++ b/dist/zeynep.js @@ -1,5 +1,5 @@ /*! -* zeynepjs v2.1.4 +* zeynepjs v2.2.0 * A light-weight multi-level jQuery side menu plugin. * It's fully customizable and is compatible with modern browsers such as Google Chrome, Mozilla Firefox, Safari, Edge and Internet Explorer * MIT License @@ -53,7 +53,7 @@ !zeynep.hasClass('submenu-opened') && zeynep.addClass('submenu-opened') // scroll to top before submenu transition - zeynep.scrollTop(0) + zeynep[0].scrollTo({ top: 0 }) eventController('opened', eventDetails) }) @@ -78,11 +78,11 @@ // close subMenu subMenuEl.removeClass('opened current') - zeynep.find('.submenu.opened:last').addClass('current') + zeynep.find('.submenu.opened').last().addClass('current') !zeynep.find('.submenu.opened').length && zeynep.removeClass('submenu-opened') // scroll to top between submenu transitions - subMenuEl.scrollTop(0) + subMenuEl[0].scrollTo({ top: 0 }) eventController('closed', eventDetails) }) @@ -191,4 +191,4 @@ return instance } -})(window.jQuery, 'zeynep') +})(window.jQuery || window.cash, 'zeynep') diff --git a/dist/zeynep.min.css b/dist/zeynep.min.css index c60d373..d1c31af 100644 --- a/dist/zeynep.min.css +++ b/dist/zeynep.min.css @@ -1,8 +1,8 @@ /*! -* zeynepjs v2.1.4 +* zeynepjs v2.2.0 * A light-weight multi-level jQuery side menu plugin. * It's fully customizable and is compatible with modern browsers such as Google Chrome, Mozilla Firefox, Safari, Edge and Internet Explorer * MIT License * by Huseyin ELMAS -*/.zeynep{bottom:0;overflow:hidden;-webkit-overflow-scrolling:touch;overflow-y:auto;pointer-events:none;position:fixed;top:0;transform:translateX(-100%);z-index:1011}.zeynep .submenu:not(.no-transition),.zeynep:not(.no-transition){transition:all 250ms}.zeynep-overlay{background-color:rgba(0,0,0,.42);bottom:0;display:none;left:0;position:fixed;right:0;top:0;z-index:1010}.zeynep-opened .zeynep-overlay{display:block}.zeynep.opened{pointer-events:auto;transform:translateX(0)}.zeynep.submenu-opened{overflow:hidden}.zeynep .submenu{bottom:0;min-height:100%;overflow:hidden;-webkit-overflow-scrolling:touch;overflow-y:auto;pointer-events:none;position:fixed;top:0;width:100%}.zeynep .submenu.opened{left:0;pointer-events:auto}.zeynep .submenu.opened:not(.current){overflow:hidden} +*/.zeynep{bottom:0;overflow:hidden;-webkit-overflow-scrolling:touch;overflow-y:auto;pointer-events:none;position:fixed;top:0;transform:translateX(-100%) translateZ(0);z-index:1011}.zeynep .submenu:not(.no-transition),.zeynep:not(.no-transition){transition:all 250ms}.zeynep-overlay{background-color:rgba(0,0,0,.42);bottom:0;display:none;left:0;position:fixed;right:0;top:0;z-index:1010}.zeynep-opened .zeynep-overlay{display:block}.zeynep.opened{pointer-events:auto;transform:translateX(0) translateZ(0)}.zeynep.submenu-opened{overflow:hidden}.zeynep .submenu{bottom:0;min-height:100%;overflow:hidden;-webkit-overflow-scrolling:touch;overflow-y:auto;pointer-events:none;position:fixed;top:0;width:100%}.zeynep .submenu.opened{left:0;pointer-events:auto}.zeynep .submenu.opened:not(.current){overflow:hidden} /*# sourceMappingURL=zeynep.min.css.map */ diff --git a/dist/zeynep.min.css.map b/dist/zeynep.min.css.map index 0b45fe9..329e66a 100644 --- a/dist/zeynep.min.css.map +++ b/dist/zeynep.min.css.map @@ -1 +1 @@ -{"version":3,"sources":["zeynep.css"],"names":[],"mappings":"AAAA;;;;;;AAAA,QAEA,OAAA,EAEA,SAAA,OAKA,2BAAA,MAJA,WAAA,KAEA,eAAA,KAJA,SAAA,MAFA,IAAA,EAOA,UAAA,kBAFA,QAAA,KAcA,qCARA,4BAGA,WAAA,IAAA,MAGA,gBAQA,iBAAA,gBAJA,OAAA,EACA,QAAA,KAHA,KAAA,EAIA,SAAA,MAHA,MAAA,EAFA,IAAA,EAMA,QAAA,KAIA,+BACA,QAAA,MAGA,eACA,eAAA,KACA,UAAA,cAGA,uBACA,SAAA,OAGA,iBAEA,OAAA,EACA,WAAA,KACA,SAAA,OAKA,2BAAA,MAJA,WAAA,KAGA,eAAA,KAFA,SAAA,MALA,IAAA,EAMA,MAAA,KAKA,wBACA,KAAA,EACA,eAAA,KAGA,sCACA,SAAA","file":"zeynep.min.css","sourcesContent":[".zeynep {\n top: 0;\n bottom: 0;\n position: fixed;\n overflow: hidden;\n overflow-y: auto;\n z-index: 1011;\n pointer-events: none;\n transform: translateX(-100%);\n -webkit-overflow-scrolling: touch;\n}\n\n.zeynep:not(.no-transition),\n.zeynep .submenu:not(.no-transition) {\n /* if transitions are not disabled */\n transition: all 250ms;\n}\n\n.zeynep-overlay {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: none;\n position: fixed;\n z-index: 1010;\n background-color: rgba(0, 0, 0, .42);\n}\n\n.zeynep-opened .zeynep-overlay {\n display: block;\n}\n\n.zeynep.opened {\n pointer-events: auto;\n transform: translateX(0px);\n}\n\n.zeynep.submenu-opened {\n overflow: hidden;\n}\n\n.zeynep .submenu {\n top: 0;\n bottom: 0;\n min-height: 100%;\n overflow: hidden;\n overflow-y: auto;\n position: fixed;\n width: 100%;\n pointer-events: none;\n -webkit-overflow-scrolling: touch;\n}\n\n.zeynep .submenu.opened {\n left: 0;\n pointer-events: auto;\n}\n\n.zeynep .submenu.opened:not(.current) {\n overflow: hidden;\n}\n"]} \ No newline at end of file +{"version":3,"sources":["zeynep.css"],"names":[],"mappings":"AAAA;;;;;;AAAA,QAEA,OAAA,EAEA,SAAA,OAKA,2BAAA,MAJA,WAAA,KAEA,eAAA,KAJA,SAAA,MAFA,IAAA,EAOA,UAAA,kBAAA,cAFA,QAAA,KAcA,qCARA,4BAGA,WAAA,IAAA,MAGA,gBAQA,iBAAA,gBAJA,OAAA,EACA,QAAA,KAHA,KAAA,EAIA,SAAA,MAHA,MAAA,EAFA,IAAA,EAMA,QAAA,KAIA,+BACA,QAAA,MAGA,eACA,eAAA,KACA,UAAA,cAAA,cAGA,uBACA,SAAA,OAGA,iBAEA,OAAA,EACA,WAAA,KACA,SAAA,OAKA,2BAAA,MAJA,WAAA,KAGA,eAAA,KAFA,SAAA,MALA,IAAA,EAMA,MAAA,KAKA,wBACA,KAAA,EACA,eAAA,KAGA,sCACA,SAAA","file":"zeynep.min.css","sourcesContent":[".zeynep {\n top: 0;\n bottom: 0;\n position: fixed;\n overflow: hidden;\n overflow-y: auto;\n z-index: 1011;\n pointer-events: none;\n transform: translateX(-100%) translateZ(0px);\n -webkit-overflow-scrolling: touch;\n}\n\n.zeynep:not(.no-transition),\n.zeynep .submenu:not(.no-transition) {\n /* if transitions are not disabled */\n transition: all 250ms;\n}\n\n.zeynep-overlay {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: none;\n position: fixed;\n z-index: 1010;\n background-color: rgba(0, 0, 0, .42);\n}\n\n.zeynep-opened .zeynep-overlay {\n display: block;\n}\n\n.zeynep.opened {\n pointer-events: auto;\n transform: translateX(0px) translateZ(0px);\n}\n\n.zeynep.submenu-opened {\n overflow: hidden;\n}\n\n.zeynep .submenu {\n top: 0;\n bottom: 0;\n min-height: 100%;\n overflow: hidden;\n overflow-y: auto;\n position: fixed;\n width: 100%;\n pointer-events: none;\n -webkit-overflow-scrolling: touch;\n}\n\n.zeynep .submenu.opened {\n left: 0;\n pointer-events: auto;\n}\n\n.zeynep .submenu.opened:not(.current) {\n overflow: hidden;\n}\n"]} \ No newline at end of file diff --git a/dist/zeynep.min.js b/dist/zeynep.min.js index de69745..5dddbdf 100644 --- a/dist/zeynep.min.js +++ b/dist/zeynep.min.js @@ -1,9 +1,9 @@ /*! -* zeynepjs v2.1.4 +* zeynepjs v2.2.0 * A light-weight multi-level jQuery side menu plugin. * It's fully customizable and is compatible with modern browsers such as Google Chrome, Mozilla Firefox, Safari, Edge and Internet Explorer * MIT License * by Huseyin ELMAS */ -!function(l,s){var n={htmlClass:!0};function i(e,t){this.element=e,this.eventController=o,this.options=l.extend({},n,t),this.options.initialized=!1,this.init()}i.prototype.init=function(){var s=this.element,e=this.options,i=this.eventController.bind(this);!0!==e.initialized&&(i("loading"),s.find("[data-submenu]").on("click",function(e){e.preventDefault();var t,n=l(this).attr("data-submenu"),o=l("#"+n);o.length&&(i("opening",t={subMenu:!0,menuId:n}),s.find(".submenu.current").removeClass("current"),o.addClass("opened current"),s.hasClass("submenu-opened")||s.addClass("submenu-opened"),s.scrollTop(0),i("opened",t))}),s.find("[data-submenu-close]").on("click",function(e){e.preventDefault();var t,n=l(this).attr("data-submenu-close"),o=l("#"+n);o.length&&(i("closing",t={subMenu:!0,menuId:n}),o.removeClass("opened current"),s.find(".submenu.opened:last").addClass("current"),s.find(".submenu.opened").length||s.removeClass("submenu-opened"),o.scrollTop(0),i("closed",t))}),i("load"),this.options.htmlClass&&!l("html").hasClass("zeynep-initialized")&&l("html").addClass("zeynep-initialized"),e.initialized=!0)},i.prototype.open=function(){this.eventController("opening",{subMenu:!1}),this.element.addClass("opened"),this.options.htmlClass&&l("html").addClass("zeynep-opened"),this.eventController("opened",{subMenu:!1})},i.prototype.close=function(e){e||this.eventController("closing",{subMenu:!1}),this.element.removeClass("opened"),this.options.htmlClass&&l("html").removeClass("zeynep-opened"),e||this.eventController("closed",{subMenu:!1})},i.prototype.destroy=function(){this.eventController("destroying"),this.close(!0),this.element.find(".submenu.opened").removeClass("opened"),this.element.removeData(s),this.eventController("destroyed"),this.options=n,this.options.htmlClass&&l("html").removeClass("zeynep-initialized"),delete this.element,delete this.options,delete this.eventController},i.prototype.on=function(e,t){r.call(this,e,t)};var o=function(e,t){if(this.options[e]){if("function"!=typeof this.options[e])throw Error("event handler must be a function: "+e);this.options[e].call(this,this.element,this.options,t)}},r=function(e,t){if("string"!=typeof e)throw Error("event name is expected to be a string but got: "+typeof e);if("function"!=typeof t)throw Error("event handler is not a function for: "+e);this.options[e]=t};l.fn[s]=function(e){var t,n,o;return t=l(this[0]),n=e,o=null,t.data(s)?o=t.data(s):(o=new i(t,n||{}),t.data(s,o)),o}}(window.jQuery,"zeynep"); +!function(l,s){var n={htmlClass:!0};function i(e,t){this.element=e,this.eventController=o,this.options=l.extend({},n,t),this.options.initialized=!1,this.init()}i.prototype.init=function(){var s=this.element,e=this.options,i=this.eventController.bind(this);!0!==e.initialized&&(i("loading"),s.find("[data-submenu]").on("click",function(e){e.preventDefault();var t,n=l(this).attr("data-submenu"),o=l("#"+n);o.length&&(i("opening",t={subMenu:!0,menuId:n}),s.find(".submenu.current").removeClass("current"),o.addClass("opened current"),s.hasClass("submenu-opened")||s.addClass("submenu-opened"),s[0].scrollTo({top:0}),i("opened",t))}),s.find("[data-submenu-close]").on("click",function(e){e.preventDefault();var t,n=l(this).attr("data-submenu-close"),o=l("#"+n);o.length&&(i("closing",t={subMenu:!0,menuId:n}),o.removeClass("opened current"),s.find(".submenu.opened").last().addClass("current"),s.find(".submenu.opened").length||s.removeClass("submenu-opened"),o[0].scrollTo({top:0}),i("closed",t))}),i("load"),this.options.htmlClass&&!l("html").hasClass("zeynep-initialized")&&l("html").addClass("zeynep-initialized"),e.initialized=!0)},i.prototype.open=function(){this.eventController("opening",{subMenu:!1}),this.element.addClass("opened"),this.options.htmlClass&&l("html").addClass("zeynep-opened"),this.eventController("opened",{subMenu:!1})},i.prototype.close=function(e){e||this.eventController("closing",{subMenu:!1}),this.element.removeClass("opened"),this.options.htmlClass&&l("html").removeClass("zeynep-opened"),e||this.eventController("closed",{subMenu:!1})},i.prototype.destroy=function(){this.eventController("destroying"),this.close(!0),this.element.find(".submenu.opened").removeClass("opened"),this.element.removeData(s),this.eventController("destroyed"),this.options=n,this.options.htmlClass&&l("html").removeClass("zeynep-initialized"),delete this.element,delete this.options,delete this.eventController},i.prototype.on=function(e,t){r.call(this,e,t)};var o=function(e,t){if(this.options[e]){if("function"!=typeof this.options[e])throw Error("event handler must be a function: "+e);this.options[e].call(this,this.element,this.options,t)}},r=function(e,t){if("string"!=typeof e)throw Error("event name is expected to be a string but got: "+typeof e);if("function"!=typeof t)throw Error("event handler is not a function for: "+e);this.options[e]=t};l.fn[s]=function(e){var t,n,o;return t=l(this[0]),n=e,o=null,t.data(s)?o=t.data(s):(o=new i(t,n||{}),t.data(s,o)),o}}(window.jQuery||window.cash,"zeynep"); //# sourceMappingURL=zeynep.min.js.map diff --git a/dist/zeynep.min.js.map b/dist/zeynep.min.js.map index 033c20b..b3bc2e8 100644 --- a/dist/zeynep.min.js.map +++ b/dist/zeynep.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["zeynep.js"],"names":["$","pluginName","defaults","htmlClass","Plugin","element","options","this","eventController","extend","initialized","init","prototype","zeynep","bind","find","on","event","preventDefault","eventDetails","subMenuId","attr","subMenuEl","length","subMenu","menuId","removeClass","addClass","hasClass","scrollTop","open","close","disableEvent","destroy","removeData","name","handler","eventBinder","call","type","details","Error","fn","instance","data","window","jQuery"],"mappings":";;;;;;;CAAA,SAAAA,EAAAC,GACA,IAAAC,EAAA,CACAC,WAAA,GAGA,SAAAC,EAAAC,EAAAC,GACAC,KAAAF,QAAAA,EANAE,KAAAC,gBAAAA,EACAD,KAAAD,QAAAN,EAAAS,OAAA,GAAAP,EAAAI,GACAC,KAAAD,QAAAI,aAAA,EAEAH,KAAAI,OAGAP,EAAAQ,UAAAD,KAAA,WACA,IAAAE,EAAAN,KAAAF,QACAC,EAAAC,KAAAD,QACAE,EAAAD,KAAAC,gBAAAM,KAAAP,OAGA,IAAAD,EAAA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GApB,EAAAQ,UAAAqB,QAAA,WACA1B,KAAAC,gBAAA,cAGAD,KAAAwB,OAAA,GAGAxB,KAAAF,QAAAU,KAAA,mBAAAW,YAAA,UAGAnB,KAAAF,QAAA6B,WAAAjC,GAEAM,KAAAC,gBAAA,aAGAD,KAAAD,QAAAJ,EAEAK,KAAAD,QAAAH,WAAAH,EAAA,QAAA0B,YAAA,6BAEAnB,KAAAF,eACAE,KAAAD,eACAC,KAAAC,iBAGAJ,EAAAQ,UAAAI,GAAA,SAAAmB,EAAAC,GACAC,EAAAC,KAAA/B,KAAA4B,EAAAC,IAGA,IAAA5B,EAAA,SAAA+B,EAAAC,GACA,GAAAjC,KAAAD,QAAAiC,GAAA,CACA,GAAA,mBAAAhC,KAAAD,QAAAiC,GAAA,MAAAE,MAAA,qCAAAF,GAGAhC,KAAAD,QAAAiC,GAAAD,KAAA/B,KAAAA,KAAAF,QAAAE,KAAAD,QAAAkC,KAqBAH,EAAA,SAAAF,EAAAC,GACA,GAAA,iBAAAD,EAAA,MAAAM,MAAA,yDAAAN,GACA,GAAA,mBAAAC,EAAA,MAAAK,MAAA,wCAAAN,GAGA5B,KAAAD,QAAA6B,GAAAC,GAKApC,EAAA0C,GAAAzC,GAAA,SAAAK,GAEA,IA9BAD,EAAAC,EACAqC,EA+BA,OAhCAtC,EA8BAL,EAAAO,KAAA,IA9BAD,EA8BAA,EA7BAqC,EAAA,KAEAtC,EAAAuC,KAAA3C,GASA0C,EAAAtC,EAAAuC,KAAA3C,IANA0C,EAAA,IAAAvC,EAAAC,EAAAC,GAAA,IAGAD,EAAAuC,KAAA3C,EAAA0C,IAMAA,GAhKA,CAmLAE,OAAAC,OAAA","file":"zeynep.min.js","sourcesContent":["(function ($, pluginName) {\n var defaults = {\n htmlClass: true\n }\n\n function Plugin (element, options) {\n this.element = element\n this.eventController = eventController\n this.options = $.extend({}, defaults, options)\n this.options.initialized = false\n\n this.init()\n }\n\n Plugin.prototype.init = function () {\n var zeynep = this.element\n var options = this.options\n var eventController = this.eventController.bind(this)\n\n // exit if already initialized\n if (options.initialized === true) return\n\n eventController('loading')\n\n // handle subMenu links/triggers click events\n zeynep.find('[data-submenu]').on('click', function (event) {\n event.preventDefault()\n\n var self = $(this)\n var subMenuId = self.attr('data-submenu')\n var subMenuEl = $('#' + subMenuId)\n\n // if subMenu not found, do nothing\n if (!subMenuEl.length) return\n\n var eventDetails = {\n subMenu: true,\n menuId: subMenuId\n }\n\n eventController('opening', eventDetails)\n\n // open the subMenu\n zeynep.find('.submenu.current').removeClass('current')\n subMenuEl.addClass('opened current')\n !zeynep.hasClass('submenu-opened') && zeynep.addClass('submenu-opened')\n\n // scroll to top before submenu transition\n zeynep.scrollTop(0)\n\n eventController('opened', eventDetails)\n })\n\n // handle subMenu closers click events\n zeynep.find('[data-submenu-close]').on('click', function (event) {\n event.preventDefault()\n\n var self = $(this)\n var subMenuId = self.attr('data-submenu-close')\n var subMenuEl = $('#' + subMenuId)\n\n // if subMenu not found, do nothing\n if (!subMenuEl.length) return\n\n var eventDetails = {\n subMenu: true,\n menuId: subMenuId\n }\n\n eventController('closing', eventDetails)\n\n // close subMenu\n subMenuEl.removeClass('opened current')\n zeynep.find('.submenu.opened:last').addClass('current')\n !zeynep.find('.submenu.opened').length && zeynep.removeClass('submenu-opened')\n\n // scroll to top between submenu transitions\n subMenuEl.scrollTop(0)\n\n eventController('closed', eventDetails)\n })\n\n eventController('load')\n\n // zeynepjs successfully initialized\n this.options.htmlClass && !$('html').hasClass('zeynep-initialized') && $('html').addClass('zeynep-initialized')\n\n options.initialized = true\n }\n\n Plugin.prototype.open = function () {\n this.eventController(\n 'opening',\n { subMenu: false }\n )\n\n // zeynepjs menu is opened\n this.element.addClass('opened')\n this.options.htmlClass && $('html').addClass('zeynep-opened')\n\n this.eventController(\n 'opened',\n { subMenu: false }\n )\n }\n\n Plugin.prototype.close = function (disableEvent) {\n !disableEvent && this.eventController('closing', { subMenu: false })\n\n // zeynepjs menu is opened\n this.element.removeClass('opened')\n this.options.htmlClass && $('html').removeClass('zeynep-opened')\n\n !disableEvent && this.eventController('closed', { subMenu: false })\n }\n\n Plugin.prototype.destroy = function () {\n this.eventController('destroying')\n\n // close the menu without firing any event\n this.close(true)\n\n // close submenus\n this.element.find('.submenu.opened').removeClass('opened')\n\n // clear/remove the instance on the element\n this.element.removeData(pluginName)\n\n this.eventController('destroyed')\n\n // reset options\n this.options = defaults\n\n this.options.htmlClass && $('html').removeClass('zeynep-initialized')\n\n delete this.element\n delete this.options\n delete this.eventController\n }\n\n Plugin.prototype.on = function (name, handler) {\n eventBinder.call(this, name, handler)\n }\n\n var eventController = function (type, details) {\n if (!this.options[type]) return\n if (typeof this.options[type] !== 'function') throw Error('event handler must be a function: ' + type)\n\n // call the event\n this.options[type].call(this, this.element, this.options, details)\n }\n\n var getInstance = function (element, options) {\n var instance = null\n\n if (!element.data(pluginName)) {\n // zeynepjs is not initialized for the element\n // crceate a new instance\n instance = new Plugin(element, options || {})\n\n // put the instance on element\n element.data(pluginName, instance)\n } else {\n // return the already initialized instance\n instance = element.data(pluginName)\n }\n\n return instance\n }\n\n var eventBinder = function (name, handler) {\n if (typeof name !== 'string') throw Error('event name is expected to be a string but got: ' + typeof name)\n if (typeof handler !== 'function') throw Error('event handler is not a function for: ' + name)\n\n // update options\n this.options[name] = handler\n }\n\n // a really lightweight plugin wrapper around the constructor\n // preventing against multiple instantiations\n $.fn[pluginName] = function (options) {\n // get a zeynepjs instance\n var instance = getInstance($(this[0]), options)\n\n return instance\n }\n})(window.jQuery, 'zeynep')\n"]} \ No newline at end of file +{"version":3,"sources":["zeynep.js"],"names":["$","pluginName","defaults","htmlClass","Plugin","element","options","this","eventController","extend","initialized","init","prototype","zeynep","bind","find","on","event","preventDefault","eventDetails","subMenuId","attr","subMenuEl","length","subMenu","menuId","removeClass","addClass","hasClass","scrollTo","top","last","open","close","disableEvent","destroy","removeData","name","handler","eventBinder","call","type","details","Error","fn","instance","data","window","jQuery","cash"],"mappings":";;;;;;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IA9BAD,EA8BAA,EA7BAuC,EAAA,KAEAxC,EAAAyC,KAAA7C,GASA4C,EAAAxC,EAAAyC,KAAA7C,IANA4C,EAAA,IAAAzC,EAAAC,EAAAC,GAAA,IAGAD,EAAAyC,KAAA7C,EAAA4C,IAMAA,GAhKA,CAmLAE,OAAAC,QAAAD,OAAAE,KAAA","file":"zeynep.min.js","sourcesContent":["(function ($, pluginName) {\n var defaults = {\n htmlClass: true\n }\n\n function Plugin (element, options) {\n this.element = element\n this.eventController = eventController\n this.options = $.extend({}, defaults, options)\n this.options.initialized = false\n\n this.init()\n }\n\n Plugin.prototype.init = function () {\n var zeynep = this.element\n var options = this.options\n var eventController = this.eventController.bind(this)\n\n // exit if already initialized\n if (options.initialized === true) return\n\n eventController('loading')\n\n // handle subMenu links/triggers click events\n zeynep.find('[data-submenu]').on('click', function (event) {\n event.preventDefault()\n\n var self = $(this)\n var subMenuId = self.attr('data-submenu')\n var subMenuEl = $('#' + subMenuId)\n\n // if subMenu not found, do nothing\n if (!subMenuEl.length) return\n\n var eventDetails = {\n subMenu: true,\n menuId: subMenuId\n }\n\n eventController('opening', eventDetails)\n\n // open the subMenu\n zeynep.find('.submenu.current').removeClass('current')\n subMenuEl.addClass('opened current')\n !zeynep.hasClass('submenu-opened') && zeynep.addClass('submenu-opened')\n\n // scroll to top before submenu transition\n zeynep[0].scrollTo({ top: 0 })\n\n eventController('opened', eventDetails)\n })\n\n // handle subMenu closers click events\n zeynep.find('[data-submenu-close]').on('click', function (event) {\n event.preventDefault()\n\n var self = $(this)\n var subMenuId = self.attr('data-submenu-close')\n var subMenuEl = $('#' + subMenuId)\n\n // if subMenu not found, do nothing\n if (!subMenuEl.length) return\n\n var eventDetails = {\n subMenu: true,\n menuId: subMenuId\n }\n\n eventController('closing', eventDetails)\n\n // close subMenu\n subMenuEl.removeClass('opened current')\n zeynep.find('.submenu.opened').last().addClass('current')\n !zeynep.find('.submenu.opened').length && zeynep.removeClass('submenu-opened')\n\n // scroll to top between submenu transitions\n subMenuEl[0].scrollTo({ top: 0 })\n\n eventController('closed', eventDetails)\n })\n\n eventController('load')\n\n // zeynepjs successfully initialized\n this.options.htmlClass && !$('html').hasClass('zeynep-initialized') && $('html').addClass('zeynep-initialized')\n\n options.initialized = true\n }\n\n Plugin.prototype.open = function () {\n this.eventController(\n 'opening',\n { subMenu: false }\n )\n\n // zeynepjs menu is opened\n this.element.addClass('opened')\n this.options.htmlClass && $('html').addClass('zeynep-opened')\n\n this.eventController(\n 'opened',\n { subMenu: false }\n )\n }\n\n Plugin.prototype.close = function (disableEvent) {\n !disableEvent && this.eventController('closing', { subMenu: false })\n\n // zeynepjs menu is opened\n this.element.removeClass('opened')\n this.options.htmlClass && $('html').removeClass('zeynep-opened')\n\n !disableEvent && this.eventController('closed', { subMenu: false })\n }\n\n Plugin.prototype.destroy = function () {\n this.eventController('destroying')\n\n // close the menu without firing any event\n this.close(true)\n\n // close submenus\n this.element.find('.submenu.opened').removeClass('opened')\n\n // clear/remove the instance on the element\n this.element.removeData(pluginName)\n\n this.eventController('destroyed')\n\n // reset options\n this.options = defaults\n\n this.options.htmlClass && $('html').removeClass('zeynep-initialized')\n\n delete this.element\n delete this.options\n delete this.eventController\n }\n\n Plugin.prototype.on = function (name, handler) {\n eventBinder.call(this, name, handler)\n }\n\n var eventController = function (type, details) {\n if (!this.options[type]) return\n if (typeof this.options[type] !== 'function') throw Error('event handler must be a function: ' + type)\n\n // call the event\n this.options[type].call(this, this.element, this.options, details)\n }\n\n var getInstance = function (element, options) {\n var instance = null\n\n if (!element.data(pluginName)) {\n // zeynepjs is not initialized for the element\n // crceate a new instance\n instance = new Plugin(element, options || {})\n\n // put the instance on element\n element.data(pluginName, instance)\n } else {\n // return the already initialized instance\n instance = element.data(pluginName)\n }\n\n return instance\n }\n\n var eventBinder = function (name, handler) {\n if (typeof name !== 'string') throw Error('event name is expected to be a string but got: ' + typeof name)\n if (typeof handler !== 'function') throw Error('event handler is not a function for: ' + name)\n\n // update options\n this.options[name] = handler\n }\n\n // a really lightweight plugin wrapper around the constructor\n // preventing against multiple instantiations\n $.fn[pluginName] = function (options) {\n // get a zeynepjs instance\n var instance = getInstance($(this[0]), options)\n\n return instance\n }\n})(window.jQuery || window.cash, 'zeynep')\n"]} \ No newline at end of file diff --git a/package.json b/package.json index ce812ff..dce4dae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zeynepjs", - "version": "2.1.4", + "version": "2.2.0", "description": "a lightweight, multi-level jQuery side menu plugin", "main": "./dist/zeynep.js", "style": "./dist/zeynep.css",