PageSourceSearch

https://skolbord.com/assets/js/main.js

js skolbord.com collected 2026-10-02 00:57:01 UTC 17,982 bytes, 562 lines download raw bytes

1(function ($) {
2  'use strict';
3
4  /*
5  |--------------------------------------------------------------------------
6  | Template Name: Educve
7  | Author: ThemeDox
8  | Version: 1.0.0
9  |--------------------------------------------------------------------------
10  |--------------------------------------------------------------------------
11  | TABLE OF CONTENTS:
12  |--------------------------------------------------------------------------
13  |
14  | 1. Preloader
15  | 2. Mobile Menu
16  | 3. Sticky Header
17  | 4. Dynamic Background
18  | 5. Slick Slider
19  | 6. Modal Video
20  | 7. Scroll Up
21  | 8. Counter Animation
22  | 9. Accordian
23  | 10. Tabs
24  | 11. Progress Bar
25  | 12. Review
26  | 13. Hobble Effect
27  | 14. Countdown Initial
28  | 15. Range Slider
29  |
30  */
31
32  /*--------------------------------------------------------------
33    Scripts initialization
34  --------------------------------------------------------------*/
35  $.exists = function (selector) {
36    return $(selector).length > 0;
37  };
38
39  $(function () {
40    preloader();
41
42    mainNav();
43    stickyHeader();
44    dynamicBackground();
45    counterInit();
46    slickInit();
47    modalVideo();
48    scrollUp();
49    accordian();
50    tabs();
51    progressBar();
52    review();
53    hobbleEffect();
54    countdownInitial();
55    rangeSlider();
56    if ($.exists('.wow')) {
57      new WOW().init();
58    }
59  });
60
61  $(window).on('scroll', function () {
62    showScrollUp();
63  });
64
65  /*--------------------------------------------------------------
66    1. Preloader
67  --------------------------------------------------------------*/
68  function preloader() {
69    // $('.td_preloader').fadeOut();
70    // $('td_preloader_in').delay(150).fadeOut('slow');
71  }
72
73  /*--------------------------------------------------------------
74    2. Mobile Menu
75  --------------------------------------------------------------*/
76  function mainNav() {
77    if (!$.exists('.td_menu_toggle')) {
78      // Remove existing elements if they exist
79      $('.td_menu_toggle').remove();
80      $('.td_munu_dropdown_toggle').remove();
81
82      // Append new elements
83      $('.td_nav').append('<span class="td_menu_toggle"><span></span></span>');
84      $('.menu-item-has-children').append(
85        '<span class="td_munu_dropdown_toggle"><span></span></span>',
86      );
87
88      function toggleMenu() {
89        $('.td_menu_toggle')
90          .toggleClass('td_toggle_active')
91          .siblings('.td_nav_list_wrap')
92          .toggleClass('td_active');
93      }
94
95      // Event handlers
96      $('.td_menu_toggle').on('click', function () {
97        toggleMenu();
98      });
99
100      $('.td_nav_list li a').on('click', function () {
101        toggleMenu();
102      });
103
104      $('.td_munu_dropdown_toggle').on('click', function () {
105        $(this).toggleClass('active').siblings('ul').slideToggle();
106        $(this).parent().toggleClass('active');
107      });
108
109      $('.td_header_dropdown_btn').on('click', function () {
110        $(this).toggleClass('active');
111      });
112
113      /* Search Toggle */
114      $('.td_search_tobble_btn').on('click', function () {
115        $('.td_header_search_wrap').toggleClass('active');
116      });
117
118      /* Side Nav */
119      $('.td_hamburger_btn').on('click', function () {
120        $('.td_side_header').addClass('active');
121        $('html').addClass('td_hamburger_active');
122      });
123
124      $('.td_close, .td_side_header_overlay').on('click', function () {
125        $('.td_side_header').removeClass('active');
126        $('html').removeClass('td_hamburger_active');
127      });
128    }
129  }
130
131  /*--------------------------------------------------------------
132    3. Sticky Header
133  --------------------------------------------------------------*/
134  function stickyHeader() {
135    var $window = $(window);
136    var lastScrollTop = 0;
137    var $header = $('.td_sticky_header');
138    var headerHeight = $header.outerHeight() + 20;
139
140    $window.scroll(function () {
141      var windowTop = $window.scrollTop();
142
143      if (windowTop >= headerHeight) {
144        $header.addClass('td_gescout_sticky');
145      } else {
146        $header.removeClass('td_gescout_sticky');
147        $header.removeClass('td_gescout_show');
148      }
149
150      if ($header.hasClass('td_gescout_sticky')) {
151        if (windowTop < lastScrollTop) {
152          $header.addClass('td_gescout_show');
153        } else {
154          $header.removeClass('td_gescout_show');
155        }
156      }
157      lastScrollTop = windowTop;
158    });
159  }
160
161  /*--------------------------------------------------------------
162    4. Dynamic Background
163  --------------------------------------------------------------*/
164  function dynamicBackground() {
165    $('[data-src]').each(function () {
166      var src = $(this).attr('data-src');
167      $(this).css({
168        'background-image': 'url(' + src + ')',
169      });
170    });
171  }
172
173  /*--------------------------------------------------------------
174    5. Slick Slider
175  --------------------------------------------------------------*/
176  function slickInit() {
177    if ($.exists('.td_slider')) {
178      $('.td_slider').each(function () {
179        var $ts = $(this).find('.td_slider_container');
180        var $slickActive = $(this).find('.td_slider_wrapper');
181        var autoPlayVar = parseInt($ts.attr('data-autoplay'), 10);
182        var autoplaySpdVar = 3000;
183        if (autoPlayVar > 1) {
184          autoplaySpdVar = autoPlayVar;
185          autoPlayVar = 1;
186        }
187        var speedVar = parseInt($ts.attr('data-speed'), 10);
188        var loopVar = Boolean(parseInt($ts.attr('data-loop'), 10));
189        var centerVar = Boolean(parseInt($ts.attr('data-center'), 10));
190        var variableWidthVar = Boolean(
191          parseInt($ts.attr('data-variable-width'), 10),
192        );
193        var paginaiton = $(this)
194          .find('.td_pagination')
195          .hasClass('td_pagination');
196        var slidesPerView = $ts.attr('data-slides-per-view');
197        if (slidesPerView == 1) {
198          slidesPerView = 1;
199        }
200        if (slidesPerView == 'responsive') {
201          var slidesPerView = parseInt($ts.attr('data-add-slides'), 10);
202          var lgPoint = parseInt($ts.attr('data-lg-slides'), 10);
203          var mdPoint = parseInt($ts.attr('data-md-slides'), 10);
204          var smPoint = parseInt($ts.attr('data-sm-slides'), 10);
205          var xsPoing = parseInt($ts.attr('data-xs-slides'), 10);
206        }
207        var fadeVar = parseInt($($ts).attr('data-fade-slide'));
208        fadeVar === 1 ? (fadeVar = true) : (fadeVar = false);
209        $slickActive.slick({
210          autoplay: autoPlayVar,
211          dots: paginaiton,
212          centerPadding: '28%',
213          speed: speedVar,
214          infinite: loopVar,
215          autoplaySpeed: autoplaySpdVar,
216          centerMode: centerVar,
217          fade: fadeVar,
218          prevArrow: $(this).find('.td_left_arrow'),
219          nextArrow: $(this).find('.td_right_arrow'),
220          appendDots: $(this).find('.td_pagination'),
221          slidesToShow: slidesPerView,
222          variableWidth: variableWidthVar,
223          swipeToSlide: true,
224          responsive: [
225            {
226              breakpoint: 1600,
227              settings: {
228                slidesToShow: lgPoint,
229              },
230            },
231            {
232              breakpoint: 1200,
233              settings: {
234                slidesToShow: mdPoint,
235              },
236            },
237            {
238              breakpoint: 992,
239              settings: {
240                slidesToShow: smPoint,
241              },
242            },
243            {
244              breakpoint: 768,
245              settings: {
246                slidesToShow: xsPoing,
247              },
248            },
249          ],
250        });
251      });
252    }
253  }
254
255  /*--------------------------------------------------------------
256    6. Modal Video
257  --------------------------------------------------------------*/
258  function modalVideo() {
259    if ($.exists('.td_video_open')) {
260      $('body').append(`
261        <div class="td_video_popup">
262          <div class="td_video_popup-overlay"></div>
263          <div class="td_video_popup-content">
264            <div class="td_video_popup-layer"></div>
265            <div class="td_video_popup-container">
266              <div class="td_video_popup-align">
267                <div class="embed-responsive embed-responsive-16by9">
268                  <iframe class="embed-responsive-item" src="about:blank"></iframe>
269                </div>
270              </div>
271              <div class="td_video_popup-close"></div>
272            </div>
273          </div>
274        </div>
275      `);
276      $(document).on('click', '.td_video_open', function (e) {
277        e.preventDefault();
278        var video = $(this).attr('href');
279
280        $('.td_video_popup-container iframe').attr('src', `${video}`);
281
282        $('.td_video_popup').addClass('active');
283      });
284      $('.td_video_popup-close, .td_video_popup-layer').on(
285        'click',
286        function (e) {
287          $('.td_video_popup').removeClass('active');
288          $('html').removeClass('overflow-hidden');
289          $('.td_video_popup-container iframe').attr('src', 'about:blank');
290          e.preventDefault();
291        },
292      );
293    }
294  }
295
296  /*--------------------------------------------------------------
297    7. Scroll Up
298  --------------------------------------------------------------*/
299  function scrollUp() {
300    $('.td_scrollup').on('click', function (e) {
301      e.preventDefault();
302      $('html,body').animate(
303        {
304          scrollTop: 0,
305        },
306        0,
307      );
308    });
309  }
310  /* For Scroll Up */
311  function showScrollUp() {
312    let scroll = $(window).scrollTop();
313    if (scroll >= 350) {
314      $('.td_scrollup').addClass('td_scrollup_show');
315    } else {
316      $('.td_scrollup').removeClass('td_scrollup_show');
317    }
318  }
319
320  /*--------------------------------------------------------------
321    8. Counter Animation
322  --------------------------------------------------------------*/
323  function counterInit() {
324    if ($.exists('.odometer')) {
325      $(window).on('scroll', function () {
326        function winScrollPosition() {
327          var scrollPos = $(window).scrollTop(),
328            winHeight = $(window).height();
329          var scrollPosition = Math.round(scrollPos + winHeight / 1.2);
330          return scrollPosition;
331        }
332
333        $('.odometer').each(function () {
334          var elemOffset = $(this).offset().top;
335          if (elemOffset < winScrollPosition()) {
336            $(this).html($(this).data('count-to'));
337          }
338        });
339      });
340    }
341  }
342
343  /*--------------------------------------------------------------
344    9. Accordian
345  --------------------------------------------------------------*/
346  function accordian() {
347    $('.td_accordian').children('.td_accordian_body').hide();
348    $('.td_accordian.active').children('.td_accordian_body').show();
349    $('.td_accordian_head').on('click', function () {
350      $(this)
351        .parent('.td_accordian')
352        .siblings()
353        .children('.td_accordian_body')
354        .slideUp(250);
355      $(this).siblings().slideDown(250);
356      $(this)
357        .parent()
358        .parent()
359        .siblings()
360        .find('.td_accordian_body')
361        .slideUp(250);
362      /* Accordian Active Class */
363      $(this).parents('.td_accordian').addClass('active');
364      $(this).parent('.td_accordian').siblings().removeClass('active');
365    });
366  }
367
368  /*--------------------------------------------------------------
369    10. Tabs
370  --------------------------------------------------------------*/
371  function tabs() {
372    $('.td_tabs .td_tab_links a').on('click', function (e) {
373      var currentAttrValue = $(this).attr('href');
374      $('.td_tabs ' + currentAttrValue)
375        .fadeIn(400)
376        .siblings()
377        .hide();
378      $(this).parents('li').addClass('active').siblings().removeClass('active');
379      e.preventDefault();
380    });
381  }
382
383  /*--------------------------------------------------------------
384    11. Progress Bar
385  --------------------------------------------------------------*/
386  function progressBar() {
387    $('.td_progress').each(function () {
388      var progressPercentage = $(this).data('progress') + '%';
389      $(this).find('.td_progress_in').css('width', progressPercentage);
390    });
391  }
392
393  /*--------------------------------------------------------------
394    12. Review
395  --------------------------------------------------------------*/
396  function review() {
397    $('.td_rating').each(function () {
398      var review = $(this).data('rating');
399      var reviewVal = review * 20 + '%';
400      $(this).find('.td_rating_percentage').css('width', reviewVal);
401    });
402  }
403
404  /*--------------------------------------------------------------
405    13. Hobble Effect
406  --------------------------------------------------------------*/
407  function hobbleEffect() {
408    $(document)
409      .on('mousemove', '.td_hobble', function (event) {
410        var halfW = this.clientWidth / 2;
411        var halfH = this.clientHeight / 2;
412        var coorX = halfW - (event.pageX - $(this).offset().left);
413        var coorY = halfH - (event.pageY - $(this).offset().top);
414        var degX1 = (coorY / halfH) * 8 + 'deg';
415        var degY1 = (coorX / halfW) * -8 + 'deg';
416        var degX2 = (coorY / halfH) * -50 + 'px';
417        var degY2 = (coorX / halfW) * 70 + 'px';
418        var degX3 = (coorY / halfH) * -15 + 'px';
419        var degY3 = (coorX / halfW) * 20 + 'px';
420        var degX4 = (coorY / halfH) * 15 + 'deg';
421        var degY4 = (coorX / halfW) * -15 + 'deg';
422        var degX5 = (coorY / halfH) * -20 + 'px';
423        var degY5 = (coorX / halfW) * 35 + 'px';
424
425        $(this)
426          .find('.td_hover_layer_1')
427          .css('transform', function () {
428            return (
429              'perspective( 800px ) translate3d( 0, 0, 0 ) rotateX(' +
430              degX1 +
431              ') rotateY(' +
432              degY1 +
433              ')'
434            );
435          });
436        $(this)
437          .find('.td_hover_layer_2')
438          .css('transform', function () {
439            return (
440              'perspective( 800px ) translateY(' +
441              degX2 +
442              ') translateX(' +
443              degY2 +
444              ')'
445            );
446          });
447        $(this)
448          .find('.td_hover_layer_3')
449          .css('transform', function () {
450            return (
451              'perspective( 800px ) translateX(' +
452              degX3 +
453              ') translateY(' +
454              degY3 +
455              ')'
456            );
457          });
458        $(this)
459          .find('.td_hover_layer_4')
460          .css('transform', function () {
461            return (
462              'perspective( 800px ) translate3d( 0, 0, 0 ) rotateX(' +
463              degX4 +
464              ') rotateY(' +
465              degY4 +
466              ')'
467            );
468          });
469        $(this)
470          .find('.td_hover_layer_5')
471          .css('transform', function () {
472            return (
473              'perspective( 800px ) translateY(' +
474              degX5 +
475              ') translateX(' +
476              degY5 +
477              ')'
478            );
479          });
480      })
481      .on('mouseout', '.td_hobble', function () {
482        $(this).find('.td_hover_layer_1').removeAttr('style');
483        $(this).find('.td_hover_layer_2').removeAttr('style');
484        $(this).find('.td_hover_layer_3').removeAttr('style');
485        $(this).find('.td_hover_layer_4').removeAttr('style');
486        $(this).find('.td_hover_layer_5').removeAttr('style');
487      });
488  }
489
490  /*--------------------------------------------------------------
491    14. Countdown Initial
492  --------------------------------------------------------------*/
493  function countdownInitial() {
494    if ($.exists('.td_countdown')) {
495      $('.td_countdown').each(function () {
496        let _this = this;
497        let el = $(_this).data('countdate');
498        // Start Only for Never end Date
499        const today = new Date();
500        const tomorrow = new Date(today);
501        tomorrow.setDate(today.getDate() + 1);
502
503        const year = tomorrow.getFullYear();
504        const month = tomorrow.getMonth() + 1;
505        const day = tomorrow.getDate();
506        const formattedTomorrow = `${year}-${
507          month < 10 ? '0' + month : month
508        }-${day < 10 ? '0' + day : day}`;
509        el = formattedTomorrow;
510        // End Only for Never end Date
511        let countDownDate = new Date(el).getTime();
512        let x = setInterval(function () {
513          let now = new Date().getTime();
514          let distance = countDownDate - now;
515          let days = Math.floor(distance / (1000 * 60 * 60 * 24));
516          let hours = Math.floor(
517            (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60),
518          );
519          let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
520          let seconds = Math.floor((distance % (1000 * 60)) / 1000);
521          $(_this).find('.td_count_days').html(days);
522          $(_this).find('.td_count_hours').html(hours);
523          $(_this).find('.td_count_minutes').html(minutes);
524          $(_this).find('.td_count_seconds').html(seconds);
525
526          if (distance < 0) {
527            clearInterval(x);
528            $(_this).find('.td_count_days').html('00');
529            $(_this).find('.td_count_hours').html('00');
530            $(_this).find('.td_count_minutes').html('00');
531            $(_this).find('.td_count_seconds').html('00');
532          }
533        }, 1000);
534      });
535    }
536  }
537
538  /*--------------------------------------------------------------
539    15. Range Slider
540  --------------------------------------------------------------*/
541  function rangeSlider() {
542    if ($.exists('#slider-range')) {
543      $('#slider-range').slider({
544        range: true,
545        min: 0,
546        max: 1000,
547        values: [100, 600],
548        slide: function (event, ui) {
549          $('#amount').val('Price: $' + ui.values[0] + ' - $' + ui.values[1]);
550        },
551      });
552    }
553    if ($.exists('#amount')) {
554      $('#amount').val(
555        'Price: $' +
556          $('#slider-range').slider('values', 0) +
557          ' - $' +
558          $('#slider-range').slider('values', 1),
559      );
560    }
561  }
562})(jQuery); // End of use strict

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.