PageSourceSearch

https://www.visittnt.com/js/side-navigation.js

js visittnt.com collected 2026-10-02 11:34:04 UTC 10,236 bytes, 323 lines download raw bytes

1// stickey 
2
3/*fixed header*/
4    window.onscroll = function() {myFunction()};
5    var header = document.getElementById("myHeader");
6    //var sticky = header.offsetTop;
7    function myFunction() {
8      if (document.body.scrollTop > 500 || document.documentElement.scrollTop > 500) {
9        header.classList.add("sticky");
10      } 
11      else {
12        header.classList.remove("sticky");
13      }
14    }
15
16  /*end fixed header*/
17
18
19// off convas menu jQuery code
20
21    $("[data-trigger]").on("click", function(e){
22        e.preventDefault();
23        e.stopPropagation();
24        var offcanvas_id =  $(this).attr('data-trigger');
25        $(offcanvas_id).toggleClass("show");
26        $('body').toggleClass("offcanvas-active");
27        $(".screen-overlay").toggleClass("show");
28
29    }); 
30
31
32    // Close menu when pressing ESC
33    $(document).on('keydown', function(event) {
34        if(event.keyCode === 27) {
35           $(".offcanvas").removeClass("show");
36           $("body").removeClass("overlay-active");
37        }
38    });
39
40    $(".btn-close, .screen-overlay").click(function(e){
41      $(".screen-overlay").removeClass("show");
42        $(".offcanvas").removeClass("show");
43        $("body").removeClass("offcanvas-active");
44
45
46    }); 
47  
48 // off convas menu jQuery code
49 
50
51;(function ( $, window, document, undefined ) {
52
53    var pluginName = 'accordion',
54        defaults = {
55            transitionSpeed: 300,
56            transitionEasing: 'ease',
57            controlElement: '[side-nav-controll]',
58            contentElement: '[side-nav-content]',
59            groupElement: '[side-nav-accrodion-group]',
60            singleOpen: true
61        };
62
63    function Accordion(element, options) {
64        this.element = element;
65        this.options = $.extend({}, defaults, options);
66        this._defaults = defaults;
67        this._name = pluginName;
68        this.init();
69    }
70
71    Accordion.prototype.init = function () {
72        var self = this,
73            opts = self.options;
74
75        var $accordion = $(self.element),
76            $content =  $accordion.find('> ' + opts.contentElement);
77
78        var accordionParentsQty = $accordion.parents('[side-nav-accrodion]').length,
79            accordionHasParent = accordionParentsQty > 0;
80
81        var closedCSS = { 'max-height': 0, 'overflow': 'hidden' };
82
83        var CSStransitions = supportsTransitions();
84
85        function debounce(func, threshold, execAsap) {
86            var timeout;
87
88            return function debounced() {
89                var obj = this,
90                    args = arguments;
91
92                function delayed() {
93                    if (!execAsap) func.apply(obj, args);
94                    timeout = null;
95                };
96
97                if (timeout) clearTimeout(timeout);
98                else if (execAsap) func.apply(obj, args);
99
100                timeout = setTimeout(delayed, threshold || 100);
101            };
102        }
103
104        function supportsTransitions() {
105            var b = document.body || document.documentElement,
106                s = b.style,
107                p = 'transition';
108
109            if (typeof s[p] == 'string') {
110                return true;
111            }
112
113            var v = ['Moz', 'webkit', 'Webkit', 'Khtml', 'O', 'ms'];
114
115            p = p.charAt(0).toUpperCase() + p.substr(1);
116
117            for (var i=0; i<v.length; i++) {
118                if (typeof s[v[i] + p] == 'string') {
119                    return true;
120                }
121            }
122
123            return false;
124        }
125
126        function requestAnimFrame(cb) {
127            return  requestAnimationFrame(cb) ||
128                    webkitRequestAnimationFrame(cb) ||
129                    mozRequestAnimationFrame(cb) ||
130            
131            function(cb) {
132                setTimeout(cb, 1000 / 60);
133            }
134        }
135
136        function toggleTransition($el, remove) {
137            if(!remove) {
138                $content.css({
139                    '-webkit-transition': 'max-height ' + opts.transitionSpeed + 'ms ' + opts.transitionEasing, 
140                    'transition': 'max-height ' + opts.transitionSpeed + 'ms ' + opts.transitionEasing
141                });
142            } else {
143                $content.css({
vendor: 4,229 bytes, lines 144-262
144                    '-webkit-transition': '',
145                    'transition': ''
146                });
147            }
148        }
149
150        function calculateHeight($el) {
151            var height = 0;
152
153            $el.children().each(function() {
154                height = height + $(this).outerHeight();
155            });
156
157            $el.data('oHeight', height);
158        }
159
160        function updateParentHeight($accordion, qty, operation) {
161            var $content = $accordion.filter('.open').find('> [side-nav-content]'),
162                $childs = $content.find('[side-nav-accrodion].open > [side-nav-content]'),
163                $matched = $content.add($childs);
164
165            if($accordion.hasClass('open')) {
166                $matched.each(function() {
167                    var currentHeight = $(this).data('oHeight');
168
169                    switch (operation) {
170                        case '+':
171                            $(this).data('oHeight', currentHeight + qty);
172                            break;
173                        case '-':
174                            $(this).data('oHeight', currentHeight - qty);
175                            break;
176                        default:
177                            throw 'updateParentHeight method needs an operation';
178                    }
179
180                    $(this).css('max-height', $(this).data('oHeight'));
181                });
182            }
183        }
184
185        function refreshHeight($accordion) {
186            if($accordion.hasClass('open')) {
187                var $content = $accordion.find('> [side-nav-content]'),
188                    $childs = $content.find('[side-nav-accrodion].open > [side-nav-content]'),
189                    $matched = $content.add($childs);
190                
191                calculateHeight($matched);
192
193                $matched.css('max-height', $matched.data('oHeight'));
194            }
195        }
196
197        function closeAccordion($accordion, $content) {
198            if(CSStransitions) {
199                if(accordionHasParent) {
200                    var $parentAccordions = $accordion.parents('[side-nav-accrodion]');
201
202                    updateParentHeight($parentAccordions, $content.data('oHeight'), '-');
203                }
204                
205                $content.css(closedCSS);
206
207                $accordion.removeClass('open');
208            } else {
209                $content.css('max-height', $content.data('oHeight'));
210
211                $content.animate(closedCSS, opts.transitionSpeed);
212
213                $accordion.removeClass('open');
214            }
215        }
216
217        function openAccordion($accordion, $content) {
218            if(CSStransitions) {
219                toggleTransition($content);
220
221                if(accordionHasParent) {
222                    var $parentAccordions = $accordion.parents('[side-nav-accrodion]');
223
224                    updateParentHeight($parentAccordions, $content.data('oHeight'), '+');
225                }
226
227                requestAnimFrame(function() {
228                    $content.css('max-height', $content.data('oHeight'));
229                });
230
231                $accordion.addClass('open');
232            } else {
233                $content.animate({
234                    'max-height': $content.data('oHeight')
235                }, opts.transitionSpeed, function() {
236                    $content.css({'max-height': 'none'});
237                });
238
239                $accordion.addClass('open');
240            }
241        }
242
243        function closeSiblingAccordions($accordion) {
244            var $accordionGroup = $accordion.closest(opts.groupElement);
245
246            var $siblings = $accordion.siblings('[side-nav-accrodion]').filter('.open'),
247                $siblingsChildren = $siblings.find('[side-nav-accrodion]').filter('.open');
248
249            var $otherAccordions = $siblings.add($siblingsChildren);
250
251            $otherAccordions.each(function() {
252                var $accordion = $(this),
253                    $content = $accordion.find(opts.contentElement);
254
255                closeAccordion($accordion, $content);
256            });
257
258            $otherAccordions.removeClass('open');
259        }
260
261        function toggleAccordion() {
262            var isAccordionGroup = (opts.singleOpen) ? $accordion.parents(opts.groupElement).length > 0 : false;
263
264            calculateHeight($content);
265
266            if(isAccordionGroup) {
267                closeSiblingAccordions($accordion);
268            }
269
270            if($accordion.hasClass('open')) {
271                closeAccordion($accordion, $content);
272            } else {
273                openAccordion($accordion, $content);
274            }
275        }
276
277        function addEventListeners() {
278            $accordion.on('click', '> '+ opts.controlElement, toggleAccordion);
279
280            $(window).on('resize', debounce(function() {
281                refreshHeight($accordion); 
282            }));
283        }
284
285        function setup() {
286            if($content.css('max-height') != 0) {
287                $(opts.contentElement).css({ 'max-height': 0, 'overflow': 'hidden' });
288            }
289
290            if(!$accordion.attr('side-nav-accrodion')) {
291                $accordion.attr('side-nav-accrodion', '');
292                $accordion.find(opts.controlElement).attr('side-nav-controll', '');
293                $accordion.find(opts.contentElement).attr('side-nav-content', '');
294            }
295        }
296
297        setup();
298        addEventListeners();
299    };
300
301    $.fn[pluginName] = function ( options ) {
302        return this.each(function () {
303            if (!$.data(this, 'plugin_' + pluginName)) {
304                $.data(this, 'plugin_' + pluginName, 
305                new Accordion( this, options ));
306            }
307        });
308    }
309
310})( jQuery, window, document );
311
312      $(document).ready(function() {
313        $('#side-side-navigation [side-nav-accrodion]').accordion();
314
315        $('#multiple [side-nav-accrodion]').accordion({
316          singleOpen: false
317        });
318
319        $('#single[side-nav-accrodion]').accordion({
320          transitionEasing: 'cubic-bezier(0.455, 0.030, 0.515, 0.955)',
321          transitionSpeed: 200
322        });
323      });

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.