PageSourceSearch

https://aircompressorhub.ru/bitrix/templates/universesite_s1/plugi…ry.owlCarousel.navigation.js?17191429784401

js aircompressorhub.ru collected 2026-10-07 02:53:10 UTC 4,401 bytes, 129 lines download raw bytes

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.