/*! * drawer v2.0.0 * * licensed under mit * author : blivesta * */ (function($) { "use strict"; var namespace = "drawer"; var touches = typeof document.ontouchstart != "undefined"; var methods = { init: function(options) { options = $.extend({ mastaclass: "drawer-main", overlayclass: "drawer-overlay", toggleclass: "drawer-toggle", upperclass: "drawer-overlay-upper", openclass: "drawer-open", closeclass: "drawer-close", responsiveclass: "drawer-responsive" }, options); return this.each(function() { var _this = this; var $this = $(this); var data = $this.data(namespace); var $upper = $("
").addclass(options.upperclass + " " + options.toggleclass); if (!data) { options = $.extend({}, options); $this.data(namespace, { options: options }) } $this.append($upper); var drawerscroll = new iscroll("." + options.mastaclass, { scrollbars: true, mousewheel: true, click: true, fadescrollbars: true }); $("." + options.toggleclass).off("click." + namespace).on("click." + namespace, function() { methods.toggle.call(_this); drawerscroll.refresh() }); $(window).resize(function() { methods.close.call(_this); drawerscroll.refresh() }) }) }, toggle: function(options) { var _this = this; var $this = $(this); options = $this.data(namespace).options; var open = $this.hasclass(options.openclass); open ? methods.close.call(_this) : methods.open.call(_this) }, open: function(options) { //$(".websitewrapper").animate({left: -$(window).width()/2+20},600); $(".websitewrapper").animate({left: -180},600); var $this = $(this); options = $this.data(namespace).options; var windowwidth = window.innerwidth ? window.innerwidth: $(window).width(); var upperwidth = windowwidth - $("." + options.mastaclass).outerwidth(); if (touches) { $this.on("touchmove." + namespace, function(event) { event.preventdefault() }) } $this.removeclass(options.closeclass).addclass(options.openclass).transitionend(function() { $("." + options.upperclass).css({ width: upperwidth, display: "block" }); $this.css({ overflow: "hidden" }) }) }, close: function(options) { $(".websitewrapper").animate({left: 0},600); var $this = $(this); options = $this.data(namespace).options; if (touches) { $this.off("touchmove." + namespace) } $("." + options.upperclass).css({ display: "none" }); $this.removeclass(options.openclass).addclass(options.closeclass).transitionend(function() { $this.css({ overflow: "auto" }); $("." + options.upperclass).css({ display: "none" }) }) }, destroy: function() { return this.each(function() { var $this = $(this); $(window).unbind("." + namespace); $this.removedata(namespace) }) } }; $.fn.drawer = function(method) { 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 on jquery." + namespace) } } })(jquery); (function($) { "use strict"; $.fn.transitionend = function(callback) { var $this = $(this); var props = "transitionend webkittransitionend moztransitionend otransitionend mstransitionend"; if ($this.length > 0) { $this.bind(props, function(event) { if ($.isfunction(callback)) { callback.call($this, event) } }) } return $this }; $.fn.animationend = function(callback) { var $this = $(this); var props = "animationend webkitanimationend mozanimationend oanimationend msanimationend"; if ($this.length > 0) { $this.bind(props, function(event) { if ($.isfunction(callback)) { callback.call($this, event) } }) } return $this } })(jquery);