PageSourceSearch

https://tnhealthskills.in/assets/js/main.js

js tnhealthskills.in collected 2026-10-09 03:48:05 UTC 22,714 bytes, 692 lines download raw bytes

1(function ($) {
2
3  "use strict";
4
5  /*
6  |--------------------------------------------------------------------------
7  | Template Name: Nischinto
8  | Author: Laralink
9  | Developer: Tamjid Bin Murtoza;
10  | Version: 1.0.0
11  |--------------------------------------------------------------------------
12  |--------------------------------------------------------------------------
13  | TABLE OF CONTENTS:
14  |--------------------------------------------------------------------------
15  |
16  | 1. Placeholder
17  | 2. Dynamic Background
18  | 3. Mobile Menu
19  | 4. Sticky Header
20  | 5. One Page Navigation
21  | 6. Isotop Initialize
22  | 7. Back To Top
23  | 8. Footer Sticky
24  | 9. Slick Slider
25  | 10. Progress Bar
26  | 11. Pricing Table
27  | 12. Ajax Contact Form And Appointment
28  | 13. Mailchimp start
29  | 14. Modal Video
30  | 15. Light Gallery
31  | 16. Tamjid Counter
32  | 17. Ripple
33  | 18. Tabs
34  | 19. Accordian
35  | 20. Before After Slider
36  |
37  */
38
39  /*--------------------------------------------------------------
40    Scripts initialization
41  --------------------------------------------------------------*/
42  $.exists = function (selector) {
43    return $(selector).length > 0;
44  };
45
46  $(window).on("load", function () {
47    $(window).trigger("scroll");
48    $(window).trigger("resize");
49    preloaderSetup();
50    isotopInit();
51  });
52
53  $(document).on("ready", function () {
54    $(window).trigger("resize");
55    dynamicBackground();
56    isotopInit();
57    backToTop();
58    stickyFooter();
59    // formValidation();
60    appointmentForm();
61    slickInit();
62    progressBarInit();
63    pricingTableInit();
64    stickyHeader();
65    onePageNavigation();
66    mobileMenu();
67    mailchimpInit();
68    modalVideo();
69    lightGallery();
70    counterInit();
71    rippleInit();
72    new WOW().init();
73    tabs();
74    accordianSetup();
75    beforeAfterSlider();
76    if ($.exists('.player')) {
77      $('.player').YTPlayer();
78    }
79    if ($.exists('#udate')) {
80      $('#udate').datepicker();
81    }
82    if ($.exists('.st_select1')) {
83      $(".st_select1").select2({
84        placeholder: function () {
85          $(this).data('placeholder');
86        },
87      });
88    }
89
90  });
91
92  $(window).on("resize", function () {
93    isotopInit();
94    stickyFooter();
95    beforeAfterSlider();
96  });
97
98  $(window).on("scroll", function () {
99    stickyHeader();
100  });
101
102  /*--------------------------------------------------------------
103    1. Placeholder
104  --------------------------------------------------------------*/
105  function preloaderSetup() {
106    $(".st-perloader").fadeOut();
107    $("st-perloader-in").delay(150).fadeOut("slow");
108  }
109
110  /*--------------------------------------------------------------
111    2. Dynamic Background
112  --------------------------------------------------------------*/
113  function dynamicBackground() {
114    // Background images
115    $('.st-dynamic-bg').each(function () {
116      var src = $(this).attr('data-src');
117      $(this).css({
118        'background-image': 'url(' + src + ')'
119      });
120    });
121  }
122
123  /*--------------------------------------------------------------
124    3. Mobile Menu
125  --------------------------------------------------------------*/
126  function mobileMenu() {
127    $('.st-nav').append('<span class="st-munu-toggle"><span></span></span>');
128    $('.menu-item-has-children').append('<span class="st-munu-dropdown-toggle"></span>');
129    $('.st-munu-toggle').on('click', function () {
130      $(this).toggleClass("st-toggle-active").siblings('.st-nav-list').slideToggle();;
131    });
132    $('.st-munu-dropdown-toggle').on('click', function () {
133      $(this).toggleClass('active').siblings('ul').slideToggle();
134    });
135    // $('.st-smooth-move').on('click', function() {
136    //   $('.st-onepage-nav').slideUp();
137    //   $('.st-munu-toggle').removeClass('st-toggle-active');
138    // })
139    // Sidebar Header
140    $('.st-site-header.st-style2').parents('body').addClass('st-get-sidebar');
141  }
142
143  /*--------------------------------------------------------------
144    4. Sticky Header
145  --------------------------------------------------------------*/
146  function stickyHeader() {
147    var scroll = $(window).scrollTop();
148    if (scroll >= 10) {
149      $('.st-sticky-header').addClass('st-sticky-active');
150    } else {
151      $('.st-sticky-header').removeClass('st-sticky-active');
152    }
153  }
154
155  /*--------------------------------------------------------------
156    5. One Page Navigation
157  --------------------------------------------------------------*/
158  function onePageNavigation() {
159    // Click To Go Top
160    $('.st-smooth-move').on('click', function () {
161      var thisAttr = $(this).attr('href');
162      console.log(thisAttr);
163  
164      // Skip Angular router links (#/home)
165      if (thisAttr && thisAttr.startsWith('#/')) {
166        return true;
167      }
168  
169      // Only scroll valid anchors
170      if (thisAttr && thisAttr.startsWith('#') && $(thisAttr).length) {
171        var scrollPoint = $(thisAttr).offset().top - 10;
172        $('body,html').animate({
173          scrollTop: scrollPoint
174        }, 800);
175      }
176      return false;
177    });
178  
179    // One Page Active Class
180    var topLimit = 300,
181      ultimateOffset = 200;
182  
183    $('.st-onepage-nav').each(function () {
184      var $this = $(this),
185        $parent = $this.parent(),
186        current = null,
187        $findLinks = $this.find("a");
188  
189      function getHeader(top) {
190        var last = $findLinks.first();
191  
192        if (top < topLimit) {
193          return last;
194        }
195  
196        for (var i = 0; i < $findLinks.length; i++) {
197          var $link = $findLinks.eq(i),
198            href = $link.attr("href");
199  
200          // Skip Angular router hashes
201          if (!href || href.startsWith('#/')) continue;
202  
203          if (href.startsWith('#')) {
204            var $anchor = $(href).first();
205            if ($anchor.length > 0) {
206              var offset = $anchor.offset();
207              if (top < offset.top - ultimateOffset) {
208                return last;
209              }
210              last = $link;
211            }
212          }
213        }
214        return last;
215      }
216  
217      $(window).on("scroll", function () {
218        var top = window.scrollY,
219          height = $this.outerHeight(),
220          max_bottom = $parent.offset().top + $parent.outerHeight(),
221          bottom = top + height + ultimateOffset;
222  
223        var $current = getHeader(top);
224  
225        if (current !== $current) {
226          // $this.find(".active").removeClass("active");
227          // $current.addClass("active");
228          // current = $current;
229        }
230      });
231    });
232  }
233  
234
235  /*--------------------------------------------------------------
236    6. Isotop Initialize
237  --------------------------------------------------------------*/
238  function isotopInit() {
239    if ($.exists('.st-isotop')) {
240      $('.st-isotop').isotope({
241        itemSelector: '.st-isotop-item',
242        transitionDuration: '0.60s',
243        percentPosition: true,
244        masonry: {
245          columnWidth: '.st-grid-sizer'
246        }
247      });
248      /* Active Class of Portfolio*/
249      $('.st-isotop-filter ul li').on('click', function (event) {
250        $(this).siblings('.active').removeClass('active');
251        $(this).addClass('active');
252        event.preventDefault();
253      });
254      /*=== Portfolio filtering ===*/
255      $('.st-isotop-filter ul').on('click', 'a', function () {
256        var filterElement = $(this).attr('data-filter');
257        $(this).parents('.st-isotop-filter').next().isotope({
258          filter: filterElement
259        });
260      });
261    }
262  }
263
264  /*--------------------------------------------------------------
265    7. Back To Top
266  --------------------------------------------------------------*/
267  function backToTop() {
268    $('#st-backtotop').on('click', function (e) {
269      e.preventDefault();
270      $('html,body').animate({
271        scrollTop: 0
272      }, 1000);
273    });
274  }
275
276  /*--------------------------------------------------------------
277    8. Footer Sticky
278  --------------------------------------------------------------*/
279  function stickyFooter() {
280    // Sticky Footer
281    var footerHeight = ($('.st-sticky-footer').height());
282    var windowHeight = $(window).height();
283    var footerHeightPx = footerHeight + 'px';
284    $('.st-content').css("margin-bottom", footerHeightPx);
285  }
286
287  /*--------------------------------------------------------------
288    9. Slick Slider
289  --------------------------------------------------------------*/
290  function slickInit() {
291    $('.st-slider').each(function () {
292      // Slick Variable
293      var $ts = $(this).find('.slick-container');
294      var $slickActive = $(this).find('.slick-wrapper');
295      var $sliderNumber = $(this).siblings('.slider-number');
296
297      // Auto Play
298      var autoPlayVar = parseInt($ts.attr('data-autoplay'), 10);
299      // Auto Play Time Out
300      var autoplaySpdVar = 3000;
301      if (autoPlayVar > 1) {
302        autoplaySpdVar = autoPlayVar;
303        autoPlayVar = 1;
304      }
305      // Slide Change Speed
306      var speedVar = parseInt($ts.attr('data-speed'), 10);
307      // Slider Loop
308      var loopVar = Boolean(parseInt($ts.attr('data-loop'), 10));
309      // Slider Center
310      var centerVar = Boolean(parseInt($ts.attr('data-center'), 10));
311      // Pagination
312      var paginaiton = $(this).children().hasClass('pagination');
313      // Slide Per View
314      var slidesPerView = $ts.attr('data-slides-per-view');
315      if (slidesPerView == 1) {
316        slidesPerView = 1;
317      }
318      if (slidesPerView == 'responsive') {
319        var slidesPerView = parseInt($ts.attr('data-add-slides'), 10);
320        var lgPoint = parseInt($ts.attr('data-lg-slides'), 10);
321        var mdPoint = parseInt($ts.attr('data-md-slides'), 10);
322        var smPoint = parseInt($ts.attr('data-sm-slides'), 10);
323        var xsPoing = parseInt($ts.attr('data-xs-slides'), 10);
324      }
325      // Fade Slider
326      var fadeVar = parseInt($($ts).attr('data-fade-slide'));
327      (fadeVar === 1) ? (fadeVar = true) : (fadeVar = false);
328
329      // Slick Active Code
330      $slickActive.slick({
331        infinite: true,
332        autoplay: autoPlayVar,
333        dots: paginaiton,
334        centerPadding: '0',
335        speed: speedVar,
336        infinite: loopVar,
337        autoplaySpeed: autoplaySpdVar,
338        centerMode: centerVar,
339        fade: fadeVar,
340        prevArrow: $(this).find('.slick-arrow-left'),
341        nextArrow: $(this).find('.slick-arrow-right'),
342        appendDots: $(this).find('.pagination'),
343        slidesToShow: slidesPerView,
344        responsive: [{
345          breakpoint: 1600,
346          settings: {
347            slidesToShow: lgPoint
348          }
349        },
350        {
351          breakpoint: 1200,
352          settings: {
353            slidesToShow: mdPoint
354          }
355        },
356        {
357          breakpoint: 992,
358          settings: {
359            slidesToShow: smPoint
360          }
361        },
362        {
363          breakpoint: 768,
364          settings: {
365            slidesToShow: xsPoing
366          }
367        }
368        ]
369      });
370    })
371  }
372
373  /*--------------------------------------------------------------
374    10. Progress Bar
375  --------------------------------------------------------------*/
376  function progressBarInit() {
377    $('.st-progressbar').each(function () {
378      var progressPercentage = $(this).data('progress') + "%";
379      $(this).find('.st-progressbar-in').css('width', progressPercentage);
380    });
381  }
382
383  /*--------------------------------------------------------------
384    11. Pricing Table
385  --------------------------------------------------------------*/
386  function pricingTableInit() {
387    $('.st-pricing-table.st-style1').hover(
388      function () {
389        $('.st-pricing-table.st-style1').addClass('st-active');
390        $(this).removeClass('st-active');
391      },
392      function () { $('.st-pricing-table.st-style1').removeClass('st-active') }
393    )
394  }
395
396  /*--------------------------------------------------------------
397    12. Ajax Contact Form And Appointment
398  --------------------------------------------------------------*/
399  // Contact Form
400//   $(document).ready(function() {
401//     $('#email-form').validate({
402//         errorContainer: $(this).find('#st-alert'),
403//         errorLabelContainer: $('ul', $(this).find('#st-alert')),
404//         wrapper: 'li',
405// 		groups: {
406// 		    mygroup: "fname lname  email phone msg"
407// 		},
408// 		 rules: {
409//       fname: "required",
410//       lname: "required",
411//       email: {
412//         required: true,
413//       },
414//         phone: {
415//         required: true,
416//       },
417//       message : "required",
418//     },
419// 		    messages: {
420//       fname: {
421//       required: "All fields need to be filled in",
422//      },  
423//      lname: {
424//       required: "All fields need to be filled in",
425//      }, 
426//       email: {
427//       required: "All fields need to be filled in",
428//     },
429//      phone: {
430//       required: "All fields need to be filled in",
431//     }, 
432//       msg: {
433//       required: "All fields need to be filled in",
434//      },
435//     },
436//     });
437// });
438
439  // Appointment Form
440  function appointmentForm() {
441    if ($.exists('#appointment-form #appointment-submit')) {
442      $('#st-alert1').hide();
443      $('#appointment-form #appointment-submit').on('click', function () {
444        var uname = $('#uname').val();
445        var uemail = $('#uemail').val();
446        var unumber = $('#unumber').val();
447        var udate = $('#udate').val();
448        var udepartment = $('#udepartment').val();
449        var udoctor = $('#udoctor').val();
450        var umsg = $('#umsg').val();
451        var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
452
453        if (!regex.test(uemail)) {
454          $('#st-alert1').fadeIn().html('<div class="alert alert-danger"><strong>Warning!</strong> Please Enter Valid Email.</div>');
455          return false;
456        }
457
458        uname = $.trim(uname);
459        uemail = $.trim(uemail);
460        unumber = $.trim(unumber);
461        udate = $.trim(udate);
462        udepartment = $.trim(udepartment);
463        udoctor = $.trim(udoctor);
464        umsg = $.trim(umsg);
465
466        if (uname != '' && uemail != '' && umsg != '') {
467          var values = "uname=" + uname +
468            "&uemail=" + uemail +
469            "&unumber=" + unumber +
470            "&udate=" + udate +
471            "&udepartment=" + udepartment +
472            "&udoctor=" + udoctor +
473            "&umsg=" + umsg;
474          $.ajax({
475            type: "POST",
476            url: "assets/php/appointment.php",
477            data: values,
478            success: function () {
479              $('#uname').val('');
480              $('#uemail').val('');
481              $('#unumber').val('');
482              $('#udepartment').val('');
483              $('#udoctor').val('');
484              $('#umsg').val('');
485
486              $('#st-alert1').fadeIn().html('<div class="alert alert-success"><strong>Success!</strong> Appointment has been sent successfully.</div>');
487              setTimeout(function () {
488                $('#st-alert1').fadeOut('slow');
489              }, 4000);
490            }
491          });
492        } else {
493          $('#st-alert1').fadeIn().html('<div class="alert alert-danger"><strong>Warning!</strong> All fields are required.</div>');
494        }
495        return false;
496      });
497    }
498  }
499
500  /*--------------------------------------------------------------
501    13. Mailchimp start
502  --------------------------------------------------------------*/
503  function mailchimpInit() {
504    if ($.exists('.mailchimp')) {
505      if ($('.mailchimp').length > 0) {
506        $('.mailchimp').ajaxChimp({
507          language: 'es',
508          callback: mailchimpCallback
509        });
510      }
511
512      function mailchimpCallback(resp) {
513        if (resp.result === 'success') {
514          $('.subscription-success').html('<i class="fa fa-check"></i><br/>' + resp.msg).fadeIn(1000);
515          $('.subscription-error').fadeOut(500);
516
517        } else if (resp.result === 'error') {
518          $('.subscription-error').html('<i class="fa fa-times"></i><br/>' + resp.msg).fadeIn(1000);
519        }
520      }
521      $.ajaxChimp.translations.es = {
522        'submit': 'Submitting...',
523        0: 'We have sent you a confirmation email',
524        1: 'Please enter a value',
525        2: 'An email address must contain a single @',
526        3: 'The domain portion of the email address is invalid (the portion after the @: )',
527        4: 'The username portion of the email address is invalid (the portion before the @: )',
528        5: 'This email address looks fake or invalid. Please enter a real email address'
529      };
530    }
531  }
532
533  /*--------------------------------------------------------------
534    14. Modal Video
535  --------------------------------------------------------------*/
536  function modalVideo() {
537    $(document).on('click', '.st-video-open', function (e) {
538      e.preventDefault();
539      var video = $(this).attr('href');
540      $('.st-video-popup-container iframe').attr('src', video);
541      $('.st-video-popup').addClass('active');
542
543    });
544    $('.st-video-popup-close, .st-video-popup-layer').on('click', function (e) {
545      $('.st-video-popup').removeClass('active');
546      $('html').removeClass('overflow-hidden');
547      $('.st-video-popup-container iframe').attr('src', 'about:blank')
548      e.preventDefault();
549    });
550  }
551
552  /*--------------------------------------------------------------
553    15. Light Gallery
554  --------------------------------------------------------------*/
555  function lightGallery() {
556    $('.st-lightgallery').each(function () {
557      $(this).lightGallery({
558        selector: '.st-lightbox-item',
559        subHtmlSelectorRelative: false,
560        thumbnail: false,
561        mousewheel: true
562      });
563    });
564  }
565
566  /*--------------------------------------------------------------
567    16. Tamjid Counter
568  --------------------------------------------------------------*/
569  function counterInit() {
570    $('.st-counter').tamjidCounter({
571      duration: 700
572    });
573  }
574
575  /*--------------------------------------------------------------
576    17. Ripple
577  --------------------------------------------------------------*/
578  function rippleInit() {
579    if ($.exists('.st-ripple-version')) {
580      $('.st-ripple-version').each(function () {
581        $('.st-ripple-version').ripples({
582          resolution: 512,
583          dropRadius: 20,
584          perturbance: 0.04,
585        });
586      });
587    }
588  }
589
590  /*--------------------------------------------------------------
591    18. Tabs
592  --------------------------------------------------------------*/
593  function tabs() {
594    $('.st-tabs.st-fade-tabs .st-tab-links a').on('click', function (e) {
595      var currentAttrValue = $(this).attr('href');
596      $('.st-tabs ' + currentAttrValue).fadeIn(400).siblings().hide();
597      $(this).parents('li').addClass('active').siblings().removeClass('active');
598      e.preventDefault();
599    });
600  }
601
602
603  /*--------------------------------------------------------------
604    19. Accordian
605  --------------------------------------------------------------*/
606  function accordianSetup() {
607    var $this = $(this);
608    $('.st-accordian').children('.st-accordian-body').hide();
609    $('.st-accordian.active').children('.st-accordian-body').show();
610    $('.st-accordian-title').on('click', function () {
611      $(this).parent('.st-accordian').siblings().children('.st-accordian-body').slideUp(250);
612      $(this).siblings().slideDown(250);
613      /* Accordian Active Class */
614      $(this).parents('.st-accordian').addClass('active');
615      $(this).parent('.st-accordian').siblings().removeClass('active');
616    });
617  }
618
619  /*--------------------------------------------------------------
620    20. Before After Slider
621  --------------------------------------------------------------*/
622  function beforeAfterSlider() {
623    if ($.exists('.st-before-after')) {
624      var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints;
625      $('.st-before-after').each(function () {
626        var $container = $(this),
627          $before = $container.find('.st-before'),
628          $after = $container.find('.st-after'),
629          $handle = $container.find('.st-handle-before-after');
630
631        var maxX = $container.outerWidth(),
632          offsetX = $container.offset().left,
633          startX = 0;
634
635        var touchstart, touchmove, touchend;
636        var mousemove = function (e) {
637          e.preventDefault();
638          var curX = e.clientX - offsetX,
639            diff = startX - curX,
640            curPos = (curX / maxX) * 100;
641          if (curPos > 100) {
642            curPos = 100;
643          }
644          if (curPos < 0) {
645            curPos = 0;
646          }
647          $before.css({ right: (100 - curPos) + "%" });
648          $handle.css({ left: curPos + "%" });
649        };
650        var mouseup = function (e) {
651          e.preventDefault();
652          if (supportsTouch) {
653            $(document).off('touchmove', touchmove);
654            $(document).off('touchend', touchend);
655          } else {
656            $(document).off('mousemove', mousemove);
657            $(document).off('mouseup', mouseup);
658          }
659        };
660        var mousedown = function (e) {
661          e.preventDefault();
662          startX = e.clientX - offsetX;
663          if (supportsTouch) {
664            $(document).on('touchmove', touchmove);
665            $(document).on('touchend', touchend);
666          } else {
667            $(document).on('mousemove', mousemove);
668            $(document).on('mouseup', mouseup);
669          }
670        };
671
672        touchstart = function (e) {
673          console.log(e);
674          mousedown({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX });
675        };
676        touchmove = function (e) {
677          mousemove({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX });
678        };
679        touchend = function (e) {
680          mouseup({ preventDefault: e.preventDefault, clientX: e.originalEvent.changedTouches[0].pageX });
681        };
682        if (supportsTouch) {
683          $handle.on('touchstart', touchstart);
684        } else {
685          $handle.on('mousedown', mousedown);
686        }
687      });
688    }
689  }
690
691
692})(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.