PageSourceSearch

https://cic.mx/wp-content/plugins/essential-addons-elementor/assets/js/one-page-nav.js?ver=1.0

js cic.mx collected 2026-10-03 20:23:35 UTC 6,397 bytes, 141 lines download raw bytes

1(function ($) {
2    "use strict";
3
4    var OnePageNavHandler = function ($scope, $) {
5        var onepage_nav_elem                = $scope.find('.eael-one-page-nav').eq(0);
6        
7        var $section_id      = '#' + onepage_nav_elem.data('section-id'),
8            $top_offset      = onepage_nav_elem.data('top-offset'),
9            $scroll_speed    = onepage_nav_elem.data('scroll-speed'),
10            $scroll_wheel    = onepage_nav_elem.data('scroll-wheel'),
11            $scroll_touch    = onepage_nav_elem.data('scroll-touch'),
12            $scroll_keys     = onepage_nav_elem.data('scroll-keys'),
13            $target_dot      = $section_id + ' .eael-one-page-nav-item a',
14            $nav_item        = $section_id + ' .eael-one-page-nav-item',
15            $active_item     = $section_id + ' .eael-one-page-nav-item.active';
16        
17        $( $target_dot ).on( 'click', function(e) {
18            e.preventDefault();
19            e.stopPropagation();
20            if( 0 === $( '#'+$(this).data('row-id') ).length ) {
21                return;
22            }
23            if ( $( 'html, body' ).is(':animated') ) {
24                return;
25            }
26            
27            $( 'html, body' ).animate({
28                scrollTop: $( '#'+$(this).data('row-id') ).offset().top - $top_offset
29            }, $scroll_speed);
30            $( $section_id + ' .eael-one-page-nav-item' ).removeClass( 'active' );
31            $(this).parent().addClass( 'active' );
32            return false;
33        } );
34        updateDot();
35        $(window).on('scroll', function() {
36            updateDot();
37        });
38        function updateDot() {
39            $('.elementor-section').each(function(){
40                var $this = $(this);
41                if ( ( $this.offset().top - $(window).height()/2 < $(window).scrollTop() ) && ( $this.offset().top >= $(window).scrollTop() || $this.offset().top + $this.height() - $(window).height()/2 > $(window).scrollTop() ) ) {
42                    $( $section_id + ' .eael-one-page-nav-item a[data-row-id="'+$this.attr('id')+'"]' ).parent().addClass('active');
43                } else {
44                    $( $section_id + ' .eael-one-page-nav-item a[data-row-id="'+$this.attr('id')+'"]' ).parent().removeClass('active');
45                }
46            });
47        }
48        if ( $scroll_wheel == 'on' ) {
49            var lastAnimation = 0,
50                quietPeriod = 500,
51                animationTime = 800,
52                startX,
53                startY,
54                timestamp;
55            $(document).on('mousewheel DOMMouseScroll', function(e){
56                var timeNow = new Date().getTime();
57                if(timeNow - lastAnimation < quietPeriod + animationTime) {
58                    e.preventDefault();
59                    return;
60                }
61                //wDelta = e.wheelDelta < 0 ? 'down' : 'up';
62                var delta = e.originalEvent.detail < 0 || e.originalEvent.wheelDelta > 0 ? 1 : -1;
63                if ( !$("html,body").is(":animated") ) {
64                    if ( delta < 0 ) {
65                        if ( $( $active_item ).next().length > 0 ) {
66                            $( $active_item ).next().find('a').trigger('click');
67                        }
68                    } else {
69                        if ( $( $active_item ).prev().length > 0 ) {
70                            $( $active_item ).prev().find('a').trigger('click');
71                        }
72                    }
73                }
74                lastAnimation = timeNow;
75            });
76            if ( $scroll_touch == 'on' ) {
77                $(document).on('pointerdown touchstart', function(e) {
78                    var touches = e.originalEvent.touches;
79                    if (touches && touches.length) {
80                        startY = touches[0].screenY;
81                        timestamp = e.originalEvent.timeStamp;
82                    }
83                }).on('touchmove', function(e) {
84                    if($("html,body").is(":animated")) {
85                        e.preventDefault();
86                    }
87                }).on('pointerup touchend', function(e) {
88                    var touches = e.originalEvent;
89                    if (touches.pointerType === 'touch' || e.type === 'touchend') {
90                        var Y = touches.screenY || touches.changedTouches[0].screenY;
91                        var deltaY = startY - Y;
92                        var time = touches.timeStamp - timestamp;
93                        // swipe up.
94                        if (deltaY < 0) {
95                            if ( $( $active_item ).prev().length > 0 ) {
96                                $( $active_item ).prev().find('a').trigger('click');
97                            }
98                        }
99                        // swipe down.
100                        if (deltaY > 0) {
101                            if ( $( $active_item ).next().length > 0 ) {
102                                $( $active_item ).next().find('a').trigger('click');
103                            }
104                        }
105                        if (Math.abs(deltaY) < 2) {
106                            return;
107                        }
108                    }
109                });
110            }
111        }
112        if ( $scroll_keys == 'on' ) {
113            $(document).keydown(function(e) {
114                var tag = e.target.tagName.toLowerCase();
115                if (tag === 'input' && tag === 'textarea') {
116                    return;
117                }
118                switch(e.which) {
119                    case 38: // up arrow key.
120                        $( $active_item ).prev().find('a').trigger('click');
121                    break;
122                    case 40: // down arrow key.
123                        $( $active_item ).next().find('a').trigger('click');
124                    break;
125                    case 33: // pageup key.
126                        $( $active_item ).prev().find('a').trigger('click');
127                    break;
128                    case 36: // pagedown key.
129                        $( $active_item ).next().find('a').trigger('click');
130                    break;
131                    default: return;
132                }
133            });
134        }
135    };
136    
137    $(window).on('elementor/frontend/init', function () {
138        elementorFrontend.hooks.addAction('frontend/element_ready/eael-one-page-nav.default', OnePageNavHandler);
139    });
140    
141}(jQuery));

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.