/* Framework averin.pro Version: 5.0.0 Docs & Examples: https://framework.averin.pro/ */ /* Part of the framework.averin.pro AverinZoom — jQuery plugin Version: 0.1 Docs & Examples: https://framework.averin.pro/ */ $(document).on('click', '.averin-zoom', onAverinZoomOpenClick); $(document).on('click', '.averin-zoom_wrapper', onAverinWrapClick); $(document).on('keydown', onAverinZoomKeyDown); /** * @param {string} src * @param {string} [title] * @return {jQuery} */ function averinZoomOpen(src, title) { $('body').css({'overflow-x': 'hidden', 'overflow-y': 'hidden'}); var $wrap = $('
'); $wrap .attr('style', 'display: none;') .addClass('averin-zoom_wrapper') .appendTo($('body')); $('') .addClass('averin-zoom_close') .html('x') .appendTo($wrap); var $content = $('
'); $content .addClass('averin-zoom_content') .appendTo($wrap); $('') .attr('alt', '') .attr('src', src) .addClass('averin-zoom_image') .appendTo($content); if(title) { $('') .addClass('averin-zoom_title') .html(title) .appendTo($content); } $wrap .fadeIn('50') .show('slow'); return $wrap; } function averinZoomClose() { var $wrap = $('.averin-zoom_wrapper'); $wrap.fadeOut('30', function () { $wrap.detach().remove(); $('body').css({'overflow-x': '', 'overflow-y': ''}); }); } function onAverinZoomOpenClick(e) { e.preventDefault(); var $zoom = $(this); var src = $zoom.data('src'); var title = $zoom.data('title'); if(!src){ src = $zoom.attr('href'); } if(!src){ src = $zoom.attr('src'); } if(!src){ src = $zoom.find('img').first().attr('src'); } if(!title){ title = $zoom.attr('title'); } if(!title){ title = $zoom.attr('alt'); } if(!title){ title = $zoom.find('img').first().attr('title'); } if(!title){ title = $zoom.find('img').first().attr('alt'); } if(!title){ title = ''; } if(!src){ console.error('Аттрибут [href] или [src] или [data-src] не найден для блока с классом [zoom]'); return false; } averinZoomOpen(src, title.trim()); return false; } function onAverinWrapClick(e) { e.preventDefault(); var $target = $(e.target); if(!$target.hasClass('averin-zoom_wrapper') && !$target.hasClass('averin-zoom_content') && !$target.hasClass('averin-zoom_close')){ return false; } averinZoomClose(); return false; } function onAverinZoomKeyDown(e) { if (e.which === 27) { averinZoomClose(); } } /* Part of the framework.averin.pro AverinSwipeMenu — jQuery plugin Version: 0.1 Docs & Examples: https://framework.averin.pro/ */ (function($) { var default_options = { 'side' : 'left' // В какую сторону открывать меню }; var methods = { open : function(options) { var options = $.extend({}, default_options, options); this.show(); $('.elevator').css("visibility", "hidden"); id = this.attr('id'); if (options.side == "left") { this.css("left", "-250px"); $('body').css("width", $('body').innerWidth()); $('body').css("position", "absolute"); $('body').animate({ left: "250" }, 100, function() { }); this.css("top", "0px"); this.animate({ left: "0" }, 100, function() { }); } if (options.side == "right") { /* this.addClass("is-offcanvasTransition"); this.css("right", "-250px"); this.css("transform", "translateX(0px)"); translateX = "-250px"; $('body').css("transform", "translateX("+translateX+")"); */ this.css("right", "-250px"); $('body').css("width", $('body').innerWidth()); $('body').css("position", "absolute"); $('body').animate({ right: "250" }, 100, function() { }); this.css("top", "0px"); this.animate({ right: "0" }, 100, function() { }); } $('body').addClass("is-no-scroll"); $('body').addClass("is-offcanvasTransition"); $('body').prepend('
'); $('.swipe_menu_overlay').fadeIn(100); }, close : function(options) { var options = $.extend({}, default_options, options); $('.elevator').css("visibility", ""); $('.swipe_menu_overlay').fadeOut(100); if (options.side == "left") { //$('#'+options.id).css("left", "-250px"); //$('body').css("transform", "translateX(0px)"); $('body').animate({ left: "0" }, 100, function() { $('body').css("position", ""); $('body').removeClass("is-no-scroll"); $('body').removeClass("is-offcanvasTransition"); $('body').css("transform", ""); $('body').css("left", ""); $('body').css("width", ""); $('#'+options.id).css("top", ''); $('#'+options.id).hide(); $('.swipe_menu_overlay').remove(); }); this.css("top", "0px"); $('#'+options.id).animate({ left: "-300" }, 100, function() { }); } if (options.side == "right") { //$('#'+options.id).css("right", "-250px"); //$('body').css("transform", "translateX(0px)"); $('body').animate({ right: "0" }, 100, function() { $('body').css("position", ""); $('body').removeClass("is-no-scroll"); $('body').removeClass("is-offcanvasTransition"); $('body').css("transform", ""); $('body').css("right", ""); $('body').css("width", ""); $('#'+options.id).css("top", ''); $('#'+options.id).hide(); $('.swipe_menu_overlay').remove(); }); this.css("top", "0px"); $('#'+options.id).animate({ right: "-300" }, 100, function() { }); } }, init : function( options ) { var options = $.extend({}, default_options, options); } }; var options = $.extend({}, default_options, options); $.fn.AverinSwipeMenu = function(method) { if (methods[method]) { return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); } else if (typeof method==='object' || !method) { return methods['open'].apply(this, arguments); } else { $.error('jquery.AverinSwipeMenu: Method ' + method + ' does not exist'); } }; })(jQuery); /* Part of the framework.averin.pro averinwindow — jQuery plugin Base plugin: arcticModal — jQuery plugin Sergey Predvoditelev (sergey.predvoditelev@gmail.com) (http://arcticlab.ru/) Version: 0.1 Docs & Examples: https://framework.averin.pro/ */ (function($) { if($.averinwindowconstructor !== 'function') { var default_options = { type: 'html', // ajax или html content: '', url: '', ajax: {}, ajax_request: null, closeOnEsc: true, closeOnOverlayClick: true, clone: false, overlay: { block: undefined, tpl: '
', css: { backgroundColor: '#000', opacity: .6 } }, container: { block: undefined, tpl: '
' }, wrap: undefined, body: undefined, errors: { tpl: '
', autoclose_delay: 2000, ajax_unsuccessful_load: 'Error' }, openEffect: { type: 'fade', speed: 400 }, closeEffect: { type: 'fade', speed: 400 }, beforeOpen: $.noop, afterOpen: $.noop, beforeClose: $.noop, afterClose: $.noop, afterLoading: $.noop, afterLoadingOnShow: $.noop, errorLoading: $.noop }; var modalID = 0; var modals = $([]); var utils = { isEventOut: function(blocks, e) { var r = true; $(blocks).each(function() { if ($(e.target).get(0)==$(this).get(0)) r = false; if ($(e.target).closest('HTML', $(this).get(0)).length==0) r = false; }); return r; } }; var modal = { getParentEl: function(el) { var r = $(el); if (r.data('averinwindow')) return r; r = $(el).closest('.averin-window-container').data('averinwindowParentEl'); if (r) return r; return false; }, transition: function(el, action, options, callback) { callback = callback==undefined ? $.noop : callback; switch (options.type) { case 'fade': action=='show' ? el.fadeIn(options.speed, callback) : el.fadeOut(options.speed, callback); break; case 'none': action=='show' ? el.show() : el.hide(); callback(); break; } }, prepare_body: function(D, $this) { // Обработчик закрытия $('.close', D.body).unbind('click.averin-window').bind('click.averin-window', function() { $this.averinwindow('close'); return false; }); }, init_el: function($this, options) { var D = $this.data('averinwindow'); if (D) return; D = options; modalID++; D.modalID = modalID; D.overlay.block = $(D.overlay.tpl); D.overlay.block.css(D.overlay.css); // Container D.container.block = $(D.container.tpl); // BODY D.body = $('.averin-window-container_i2', D.container.block); if (options.clone) { D.body.html($this.clone(true)); } else { $this.before('