1(function ($) { 2 'use strict'; 3 4 /* 5 |-------------------------------------------------------------------------- 6 | Template Name: ProHealth 7 | Author: Laralink 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. Swiper Initialize 19 | 6. Modal Video 20 | 7. Isotop 21 | 8. Parallax 22 | 9. Scroll Up 23 | 10. Ripple 24 | 11. Counter Animation 25 | 12. Accordian 26 | 13. Tab 27 | 14. Review 28 | 15. Light Gallery 29 | 16. List And Grid View 30 | 17. Light Gallery 31 | 18. Cursor Animation 32 | 33 */ 34 35 /*-------------------------------------------------------------- 36 Scripts initialization 37 --------------------------------------------------------------*/ 38 $.exists = function (selector) { 39 return $(selector).length > 0; 40 }; 41 42 $(window).on('load', function () { 43 preloader(); 44 isotopInit(); 45 }); 46 47 $(function () { 48 mainNav(); 49 stickyHeader(); 50 dynamicBackground(); 51 counterInit(); 52 swiperInit(); 53 modalVideo(); 54 isotopInit(); 55 parallaxEffect(); 56 scrollUp(); 57 rippleInit(); 58 accordian(); 59 tabs(); 60 review(); 61 lightGallery(); 62 listAndGridView(); 63 if ($.exists('.player')) { 64 $('.player').YTPlayer(); 65 } 66 }); 67 68 $(window).on('scroll', function () { 69 parallaxEffect(); 70 counterInit(); 71 showScrollUp(); 72 }); 73 74 /*-------------------------------------------------------------- 75 1. Preloader 76 --------------------------------------------------------------*/ 77 function preloader() { 78 $('.cs_perloader').fadeOut(); 79 $('cs_perloader_in').delay(150).fadeOut('slow'); 80 } 81 82 /*-------------------------------------------------------------- 83 2. Mobile Menu 84 --------------------------------------------------------------*/ 85 function mainNav() { 86 $('.cs_nav').append('<span class="cs_menu_toggle"><span></span></span>'); 87 $('.menu-item-has-children').append( 88 '<span class="cs_munu_dropdown_toggle"><span></span></span>', 89 ); 90 $('.cs_menu_toggle').on('click', function () { 91 $(this) 92 .toggleClass('cs_toggle_active') 93 .siblings('.cs_nav_list') 94 .toggleClass('cs_active'); 95 }); 96 $('.cs_menu_toggle') 97 .parents('body') 98 .find('.cs_side_header') 99 .addClass('cs_has_main_nav'); 100 $('.cs_munu_dropdown_toggle').on('click', function () { 101 $(this).toggleClass('active').siblings('ul').slideToggle(); 102 $(this).parent().toggleClass('active'); 103 }); 104 105 // Side Nav and Search 106 $('.cs_sidebar_toggle_btn').on('click', function () { 107 $('.cs_sidenav').addClass('active'); 108 }); 109 $('.cs_search_toggle_btn').on('click', function () { 110 $('.cs_header_search').addClass('active'); 111 }); 112 $('.cs_close, .cs_sidenav_overlay').on('click', function () { 113 $('.cs_sidenav, .cs_header_search').removeClass('active'); 114 }); 115 } 116 117 /*-------------------------------------------------------------- 118 3. Sticky Header 119 --------------------------------------------------------------*/ 120 function stickyHeader() { 121 var $window = $(window); 122 var lastScrollTop = 0; 123 var $header = $('.cs_sticky_header'); 124 var headerHeight = $header.outerHeight() + 30; 125 126 $window.scroll(function () { 127 var windowTop = $window.scrollTop(); 128 129 if (windowTop >= headerHeight) { 130 $header.addClass('cs_gescout_sticky'); 131 } else { 132 $header.removeClass('cs_gescout_sticky'); 133 $header.removeClass('cs_gescout_show'); 134 } 135 136 if ($header.hasClass('cs_gescout_sticky')) { 137 if (windowTop < lastScrollTop) { 138 $header.addClass('cs_gescout_show'); 139 } else { 140 $header.removeClass('cs_gescout_show'); 141 } 142 } 143 144 lastScrollTop = windowTop; 145 }); 146 } 147 148 /*--------------------------------------------------------------
149 4. Dynamic Background 150 --------------------------------------------------------------*/ 151 function dynamicBackground() { 152 $('[data-src]').each(function () { 153 var src = $(this).attr('data-src'); 154 $(this).css({ 155 'background-image': 'url(' + src + ')', 156 }); 157 }); 158 } 159 160 /*-------------------------------------------------------------- 161 5. Swiper Initialize 162 --------------------------------------------------------------*/ 163 function swiperInit() { 164 if ($.exists('.cs_department_carousel')) { 165 $('.cs_department_carousel').each(function () { 166 var $slickActive = $(this).find('.cs_slider_activate'); 167 $slickActive.slick({ 168 slidesToShow: 6, 169 infinite: true, 170 slidesToScroll: 1, 171 autoplay: false, 172 autoplaySpeed: 2000, 173 dots: false, 174 arrows: true, 175 prevArrow: $(this).find('.cs_slider_prev'), 176 nextArrow: $(this).find('.cs_slider_next'), 177 responsive: [ 178 { 179 breakpoint: 1700, 180 settings: { 181 slidesToShow: 5, 182 }, 183 }, 184 { 185 breakpoint: 1199, 186 settings: { 187 slidesToShow: 4, 188 }, 189 }, 190 { 191 breakpoint: 991, 192 settings: { 193 slidesToShow: 3, 194 }, 195 }, 196 { 197 breakpoint: 767, 198 settings: { 199 slidesToShow: 2, 200 }, 201 }, 202 { 203 breakpoint: 420, 204 settings: { 205 slidesToShow: 1, 206 }, 207 }, 208 ], 209 }); 210 }); 211 } 212 213 if ($.exists('.cs_brand_carousel')) { 214 $('.cs_brand_carousel').each(function () { 215 var $slickActive = $(this).find('.cs_slider_activate'); 216 $slickActive.slick({ 217 slidesToShow: 5, 218 infinite: true, 219 slidesToScroll: 1, 220 autoplay: false, 221 autoplaySpeed: 2000, 222 dots: true, 223 arrows: false, 224 responsive: [ 225 { 226 breakpoint: 1350, 227 settings: { 228 slidesToShow: 3, 229 }, 230 }, 231 { 232 breakpoint: 991, 233 settings: { 234 slidesToShow: 2, 235 }, 236 }, 237 { 238 breakpoint: 575, 239 settings: { 240 slidesToShow: 1, 241 }, 242 }, 243 ], 244 }); 245 }); 246 } 247 248 if ($.exists('.cs_testimonial_carousel')) { 249 $('.cs_testimonial_carousel').each(function () { 250 var $slickActive = $(this).find('.cs_slider_activate'); 251 $slickActive.slick({ 252 slidesToShow: 2, 253 infinite: true, 254 slidesToScroll: 1, 255 autoplay: false, 256 autoplaySpeed: 2000, 257 dots: false, 258 prevArrow: $(this).find('.cs_slider_prev'), 259 nextArrow: $(this).find('.cs_slider_next'), 260 responsive: [ 261 { 262 breakpoint: 1199, 263 settings: { 264 slidesToShow: 1, 265 }, 266 }, 267 { 268 breakpoint: 575, 269 settings: { 270 slidesToShow: 1, 271 }, 272 }, 273 ], 274 }); 275 }); 276 } 277 278 if ($.exists('.cs_testimonial_carousel_2')) { 279 $('.cs_testimonial_carousel_2').each(function () { 280 var $slickActive = $(this).find('.cs_slider_activate'); 281 $slickActive.slick({ 282 slidesToShow: 2, 283 infinite: true, 284 slidesToScroll: 1, 285 autoplay: false, 286 autoplaySpeed: 2000, 287 dots: false, 288 prevArrow: $(this).find('.cs_slider_prev'), 289 nextArrow: $(this).find('.cs_slider_next'), 290 variableWidth: true, 291 }); 292 }); 293 } 294 295 if ($.exists('.cs_iconbox_carousel_1')) { 296 $('.cs_iconbox_carousel_1').each(function () { 297 var $slickActive = $(this).find('.cs_slider_activate'); 298 $slickActive.slick({ 299 slidesToShow: 4, 300 infinite: true, 301 slidesToScroll: 1, 302 autoplay: false, 303 autoplaySpeed: 2000,
304 dots: false, 305 variableWidth: true, 306 prevArrow: $(this).find('.cs_slider_prev'), 307 nextArrow: $(this).find('.cs_slider_next'), 308 }); 309 }); 310 } 311 if ($.exists('.cs_related_doctor')) { 312 $('.cs_related_doctor').each(function () { 313 var $slickActive = $(this).find('.cs_slider_activate'); 314 $slickActive.slick({ 315 slidesToShow: 1, 316 infinite: true, 317 slidesToScroll: 1, 318 autoplay: false, 319 autoplaySpeed: 2000, 320 dots: true, 321 prevArrow: $(this).find('.cs_slider_prev'), 322 nextArrow: $(this).find('.cs_slider_next'), 323 }); 324 }); 325 } 326 } 327 328 /*-------------------------------------------------------------- 329 6. Modal Video 330 --------------------------------------------------------------*/ 331 function modalVideo() { 332 if ($.exists('.cs_video_open')) { 333 $('body').append(` 334 <div class="cs_video_popup"> 335 <div class="cs_video_popup_overlay"></div> 336 <div class="cs_video_popup_content"> 337 <div class="cs_video_popup_layer"></div> 338 <div class="cs_video_popup_container"> 339 <div class="cs_video_popup_align"> 340 <div class="embed-responsive embed-responsive-16by9"> 341 <iframe class="embed-responsive-item" src="about:blank"></iframe> 342 </div> 343 </div> 344 <div class="cs_video_popup_close"></div> 345 </div> 346 </div> 347 </div> 348 `); 349 $(document).on('click', '.cs_video_open', function (e) { 350 e.preventDefault(); 351 var video = $(this).attr('href'); 352 353 $('.cs_video_popup_container iframe').attr('src', `${video}`); 354 355 $('.cs_video_popup').addClass('active'); 356 }); 357 $('.cs_video_popup_close, .cs_video_popup_layer').on( 358 'click', 359 function (e) { 360 $('.cs_video_popup').removeClass('active'); 361 $('html').removeClass('overflow-hidden'); 362 $('.cs_video_popup_container iframe').attr('src', 'about:blank'); 363 e.preventDefault(); 364 }, 365 ); 366 } 367 } 368 369 /*-------------------------------------------------------------- 370 7. Isotop 371 --------------------------------------------------------------*/ 372 function isotopInit() { 373 if ($.exists('.cs_isotop')) { 374 $('.cs_isotop').isotope({ 375 itemSelector: '.cs_isotop_item', 376 transitionDuration: '0.60s', 377 percentPosition: true, 378 masonry: { 379 columnWidth: '.cs_grid_sizer', 380 }, 381 }); 382 /* Active Class of Portfolio*/ 383 $('.cs_isotop_filter ul li').on('click', function (event) { 384 $(this).siblings('.active').removeClass('active'); 385 $(this).addClass('active'); 386 event.preventDefault(); 387 }); 388 /*=== Portfolio filtering ===*/ 389 $('.cs_isotop_filter ul').on('click', 'a', function () { 390 var filterElement = $(this).attr('data-filter'); 391 $('.cs_isotop').isotope({ 392 filter: filterElement, 393 }); 394 }); 395 } 396 } 397 398 /*-------------------------------------------------------------- 399 8. Parallax 400 --------------------------------------------------------------*/ 401 function parallaxEffect() { 402 $('.cs_parallax').each(function () { 403 var windowScroll = $(document).scrollTop(), 404 windowHeight = $(window).height(), 405 barOffset = $(this).offset().top, 406 barHeight = $(this).height(), 407 barScrollAtZero = windowScroll - barOffset + windowHeight, 408 barHeightWindowHeight = windowScroll + windowHeight, 409 barScrollUp = barOffset <= windowScroll + windowHeight, 410 barSctollDown = barOffset + barHeight >= windowScroll; 411 412 if (barSctollDown && barScrollUp) { 413 var calculadedHeight = barHeightWindowHeight - barOffset; 414 var mediumEffectPixel = barScrollAtZero / 7; 415 var miniEffectPixel = calculadedHeight / 10; 416 var miniEffectPixel2 = calculadedHeight / 3; 417 var miniEffectPixel3 = calculadedHeight / 6; 418 var miniEffectPixel4 = barScrollAtZero / 5; 419 $(this) 420 .find('.cs_to_left') 421 .css('transform', `translateX(-${miniEffectPixel}px)`); 422 $(this) 423 .find('.cs_to_right') 424 .css('transform', `translateX(${miniEffectPixel}px)`); 425 $(this) 426 .find('.cs_to_up') 427 .css('transform', `translateY(-${miniEffectPixel}px)`); 428 $(this) 429 .find('.cs_to_up_2') 430 .css('transform', `translateY(-${miniEffectPixel2}px)`); 431 $(this) 432 .find('.cs_to_up_3') 433 .css('transform', `translateY(-${miniEffectPixel3}px)`); 434 $(this) 435 .find('.cs_to_up_4') 436 .css('transform', `translateY(-${miniEffectPixel4}px)`); 437 $(this) 438 .find('.cs_to_down') 439 .css('transform', `translateY(${miniEffectPixel}px)`); 440 $(this) 441 .find('.cs_to_rotate') 442 .css('transform', `rotate(${miniEffectPixel}deg)`); 443 $(this) 444 .find('.cs_parallax_bg') 445 .css('background-position', `center -${mediumEffectPixel}px`); 446 } 447 }); 448 } 449 450 /*-------------------------------------------------------------- 451 9. Scroll Up 452 --------------------------------------------------------------*/ 453 function scrollUp() { 454 $('.cs_scrollup').on('click', function (e) { 455 e.preventDefault(); 456 $('html,body').animate( 457 { 458 scrollTop: 0, 459 }, 460 0, 461 ); 462 }); 463 } 464 function showScrollUp() { 465 let scroll = $(window).scrollTop(); 466 if (scroll >= 350) {
467 $('.cs_scrollup').addClass('cs_scrollup_show'); 468 } else { 469 $('.cs_scrollup').removeClass('cs_scrollup_show'); 470 } 471 } 472 473 /*-------------------------------------------------------------- 474 10. Ripple 475 --------------------------------------------------------------*/ 476 function rippleInit() { 477 if ($.exists('.cs_ripple_activate')) { 478 $('.cs_ripple_activate').each(function () { 479 $('.cs_ripple_activate').ripples({ 480 resolution: 512, 481 dropRadius: 20, 482 perturbance: 0.04, 483 }); 484 }); 485 } 486 } 487 488 /*-------------------------------------------------------------- 489 11. Counter Animation 490 --------------------------------------------------------------*/ 491 function counterInit() { 492 if ($.exists('.odometer')) { 493 function winScrollPosition() { 494 var scrollPos = $(window).scrollTop(), 495 winHeight = $(window).height(); 496 var scrollPosition = Math.round(scrollPos + winHeight / 1.2); 497 return scrollPosition; 498 } 499 500 $('.odometer').each(function () { 501 var elemOffset = $(this).offset().top; 502 if (elemOffset < winScrollPosition()) { 503 $(this).html($(this).data('count-to')); 504 } 505 }); 506 } 507 } 508 509 /*-------------------------------------------------------------- 510 12. Accordian 511 --------------------------------------------------------------*/ 512 function accordian() { 513 $('.cs_accordian').children('.cs_accordian_body').hide(); 514 $('.cs_accordian.active').children('.cs_accordian_body').show(); 515 $('.cs_accordian_head').on('click', function () { 516 $(this) 517 .parent('.cs_accordian') 518 .siblings() 519 .children('.cs_accordian_body') 520 .slideUp(250); 521 $(this).siblings().slideDown(250); 522 $(this) 523 .parent() 524 .parent() 525 .siblings() 526 .find('.cs_accordian_body') 527 .slideUp(250); 528 /* Accordian Active Class */ 529 $(this).parents('.cs_accordian').addClass('active'); 530 $(this).parent('.cs_accordian').siblings().removeClass('active'); 531 }); 532 } 533 534 /*-------------------------------------------------------------- 535 13. Tab 536 --------------------------------------------------------------*/ 537 function tabs() { 538 $('.cs_tabs .cs_tab_links a').on('click', function (e) { 539 var currentAttrValue = $(this).attr('href'); 540 $('.cs_tabs ' + currentAttrValue) 541 .fadeIn(400) 542 .siblings() 543 .hide(); 544 $(this).parents('li').addClass('active').siblings().removeClass('active'); 545 e.preventDefault(); 546 }); 547 } 548 549 /*-------------------------------------------------------------- 550 14. Review 551 --------------------------------------------------------------*/ 552 function review() { 553 $('.cs_rating').each(function () { 554 var review = $(this).data('rating'); 555 var reviewVal = review * 20 + '%'; 556 $(this).find('.cs_rating_percentage').css('width', reviewVal); 557 }); 558 } 559 560 /*-------------------------------------------------------------- 561 15. Light Gallery 562 --------------------------------------------------------------*/ 563 function lightGallery() { 564 $('.cs_lightgallery').each(function () { 565 $(this).lightGallery({ 566 selector: '.st_lightbox_item', 567 subHtmlSelectorRelative: false, 568 thumbnail: false, 569 mousewheel: true, 570 }); 571 }); 572 } 573 574 /*-------------------------------------------------------------- 575 16. List And Grid View 576 --------------------------------------------------------------*/ 577 function listAndGridView() { 578 $('.cs_list_view').on('click', function () { 579 $(this).addClass('active').siblings().removeClass('active'); 580 $('.cs_isotop') 581 .removeClass('cs_isotop_col_3 cs_grid_view_wrap') 582 .addClass('cs_isotop_col_1 cs_list_view_wrap'); 583 isotopInit(); 584 }); 585 586 $('.cs_grid_view').on('click', function () { 587 $(this).addClass('active').siblings().removeClass('active'); 588 $('.cs_isotop') 589 .removeClass('cs_isotop_col_1 cs_list_view_wrap') 590 .addClass('cs_isotop_col_3 cs_grid_view_wrap'); 591 isotopInit(); 592 }); 593 } 594 595 596 /*-------------------------------------------------------------- 597 18. Cursor Animation 598 --------------------------------------------------------------*/ 599 $(function () { 600 $('body').append('<span class="cs_cursor_lg d"></span>'); 601 $('body').append('<span class="cs_cursor_sm"></span>'); 602 603 $('.cs_view_mouse').on('mouseenter', function () { 604 $('.cs_cursor_lg').addClass('opacity-0'); 605 $('.cs_cursor_sm').addClass('opacity-0'); 606 }); 607 $('.cs_view_mouse').on('mouseleave', function () { 608 $('.cs_cursor_lg').removeClass('opacity-0'); 609 $('.cs_cursor_sm').removeClass('opacity-0'); 610 }); 611 }); 612 $( 613 '<div class="cursor" id="client_cursor"><i class="fa-solid fa-link"></i></div>', 614 ).insertBefore('body'); 615 function cursorMovingAnimation(event) { 616 try { 617 const timing = gsap.timeline({ 618 defaults: { 619 x: event.clientX, 620 y: event.clientY, 621 }, 622 }); 623 624 timing 625 .to('.cs_cursor_lg', { 626 ease: 'power2.out', 627 }) 628 .to( 629 '.cs_cursor_sm', 630 { 631 ease: 'power2.out', 632 },
633 '-=0.4', 634 ); 635 636 //////////////////////////// 637 // Home Page Client Cursor 638 const target = event.target; 639 640 let tl = gsap.timeline({ 641 defaults: { 642 x: event.clientX, 643 y: event.clientY, 644 }, 645 }); 646 let t2 = gsap.timeline({ 647 defaults: { 648 x: event.clientX, 649 y: event.clientY, 650 }, 651 }); 652 var client_cursor = document.getElementById('client_cursor'); 653 if (target.closest('.cs_view_mouse')) { 654 tl.to( 655 client_cursor, 656 { 657 opacity: 1, 658 zoom: 1, 659 ease: 'power2.out', 660 }, 661 '-=0.3', 662 ); 663 } else { 664 t2.to( 665 client_cursor, 666 { 667 opacity: 0, 668 ease: 'power2.out', 669 }, 670 '-=0.3', 671 ); 672 } 673 } catch (err) { 674 console.log(err); 675 } 676 } 677 document.addEventListener('mousemove', cursorMovingAnimation); 678})(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.