1/** 2 * Navigation 3 * @since 2.0.0 4 */ 5;(function ($, window, document, undefined) { 6 var plugin; 7 8 plugin = function (core) { 9 this._core = core; 10 11 /** 12 * СÑаÑÑÑ Ð¸Ð½Ð¸ÑиализаÑии плагина. 13 * @protected 14 * @type {Boolean} 15 */ 16 this._initialized = false; 17 18 /** 19 * ÐлавнÑй ÑлеменÑ. 20 * @type {jQuery} 21 */ 22 this.$element = this._core.$element; 23 24 /** 25 * ÐÐ»ÐµÐ¼ÐµÐ½Ñ Ñо Ñлайдами. 26 * @type {jQuery} 27 */ 28 this.$stage = null; 29 30 /** 31 * ÐбеÑÑка ÑлеменÑа Ñо Ñлайдами. 32 * @type {jQuery} 33 */ 34 this.$overlay = null; 35 36 /** 37 * ÐбÑабоÑÑики ÑобÑÑий ÑлеменÑа Ñо Ñлайдами. 38 * @type {jQuery} 39 */ 40 this._overlayHandlers = { 41 'mousemove': $.proxy(function (e) { 42 if (this._initialized) { 43 var settings = this._core.settings; 44 var node = this.$overlay; 45 46 if (settings['overlayNav']) { 47 var pages = 0; 48 var side = 0; 49 var position = 0; 50 51 if (settings['overlayNavByPages'] && this._core._plugins.navigation) { 52 pages = Math.ceil(this._core.items().length / settings.items); 53 } else { 54 pages = this._core.items().length - settings.items + 1; 55 } 56 57 if (pages < 0) 58 pages = 1; 59 60 if (settings['overlayNavOrientation'] === 'horizontal') { 61 side = node.outerWidth(false); 62 position = e.pageX - node.offset().left; 63 } else { 64 side = node.outerHeight(false); 65 position = e.pageY - node.offset().top; 66 } 67 68 var slide = Math.ceil(position / (side / pages)); 69 70 if (slide < 1) 71 slide = 1; 72 73 if (slide > pages) 74 slide = pages; 75 76 if (this._core._plugins.navigation) { 77 this._core.to(slide - 1, null, !settings['overlayNavByPages']); 78 } else { 79 this._core.to(slide - 1); 80 } 81 } 82 } 83 }, this) 84 }; 85 86 /** 87 * ÐбÑабоÑÑики ÑобÑÑий плагина. 88 * @protected 89 * @type {Object} 90 */ 91 this._handlers = { 92 'initialized.owl.carousel': $.proxy(function (e) { 93 if (!this._initialized) { 94 this.initialize(); 95 this._initialized = true; 96 } 97 }, this) 98 }; 99 100 // ÐаÑÑÑойки по ÑмолÑÐ°Ð½Ð¸Ñ 101 this._core.options = $.extend({}, plugin.Defaults, this._core.options); 102 103 this.$element.on(this._handlers); 104 }; 105 106 plugin.Defaults = { 107 'overlayNav': false, // ÐклÑÑиÑÑ Ð½Ð°Ð²Ð¸Ð³Ð°ÑÐ¸Ñ Ð¿Ñи наведении 108 'overlayNavByPages': false, // ÐавигаÑÐ¸Ñ Ð¿Ð¾ ÑÑÑаниÑам (ÐÑли подклÑÑен плагин Navigation) 109 'overlayNavOrientation': 'horizontal' // ÐÑиенÑаÑÐ¸Ñ Ð½Ð°Ð²Ð¸Ð³Ð°Ñии пÑи наведении (horizontal|vertical) 110 }; 111 112 plugin.prototype.initialize = function () { 113 this.$stage = this._core.$stage; 114 this.$overlay = this.$stage.parent(); 115 this.$overlay.on(this._overlayHandlers); 116 }; 117 118 plugin.prototype.destroy = function() { 119 $.each(this._handlers, function (event, handler) { 120 this.$element.off(event, handler); 121 }); 122 123 $.each(this._overlayHandlers, function (event, handler) { 124 this.$overlay.off(event, handler); 125 }); 126 }; 127 128 $.fn.owlCarousel.Constructor.Plugins['OverlayNavigation'] = plugin; 129})(window.Zepto || window.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.