$(function () { "use strict"; var $document = $(document), $window = $(window), windowWidth = window.innerWidth || $window.width(), windowH = $window.height(); // Template options var templateOption = { mobileMenuBreikpont: 1023, smoothScroll: false, // smooth scroll enable (set 'false' for disable) backToTop: true // back to top button enable (set 'false' for disable) }, // Google map options googleMapOption = { latitude: 59.3, longitude: 18.0941403, zoom: 14, marker: [ ['Our Clinic', 59.3, 18.0941403, 1, 'images/map-marker.png'] ] }, // Template Blocks blocks = { mainSlider: $('.main-slider'), servicesCarousel: $('.js-services-carousel'), icnCarousel: $('.js-icn-carousel'), icnAltCarousel: $('.js-icn-text-alt-carousel'), counterCarousel: $('.js-counter-carousel'), specialCarousel: $('.js-special-carousel'), reviewsCarousel: $('.js-reviews-carousel'), singleCarousel: $('.js-slider-single'), googleMapHeader: 'googleMapDrop', googleMapContact: 'googleMapContact', galleryMain: '.js-slider-gallery-main', galleryThumbs: '.js-slider-gallery-thumbs', isotopeGallery: $('.gallery-isotope'), specialistCarousel: $('.js-specialist-carousel'), postGallery: $('.blog-isotope'), counterBlock: $('.counter-box'), postCarousel: $('.js-post-carousel'), singleServiceCarousel: $('.js-single-service-carousel'), testimonialCarousel: $('.js-testimonial-card-carousel'), blogCarousel: $('.js-blog-grid-carousel'), blogCarouselFull: $('.js-blog-grid-carousel-full'), galleryHoverCarousel: $('.js-gallery-hover-carousel'), reviewsTextCarousel: $('.js-reviews-text-carousel'), serviceBoxRotator: $('.js-service-box-rotator'), service2Carousel: $('.js-service-card-style2-carousel') }; // Detect Touch Devices window.mobileCheck = function () { var i = !1; return function (a) { (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) && (i = !0) }(navigator.userAgent || navigator.vendor || window.opera), i }; var isTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints; if (isTouch) { $('body').addClass('touch'); } if (templateOption.preloader) { $('.loading-body').delay(1500).fadeOut(750); } else $('.loading-body').remove(); // Time Out Resize (Debouncer) function debouncer(func, timeout) { var timeoutID, timeout = timeout || 500; return function () { var scope = this, args = arguments; clearTimeout(timeoutID); timeoutID = setTimeout(function () { func.apply(scope, Array.prototype.slice.call(args)); }, timeout); }; } // Main Slider if (blocks.mainSlider.length) { var $el = blocks.mainSlider; $el.each(function () { $el.find('.slide').first().find('.img--holder').imagesLoaded({ background: true }, function () { setTimeout(function () { $el.on('init', function (e, slick) { var $firstAnimatingElements = $('div.slide:first-child').find('[data-animation]'); doAnimations($firstAnimatingElements); }); $el.on('beforeChange', function (e, slick, currentSlide, nextSlide) { var $currentSlide = $('div.slide[data-slick-index="' + nextSlide + '"]'); var $animatingElements = $currentSlide.find('[data-animation]'); doAnimations($animatingElements); }); $el.slick({ autoplay: true, autoplaySpeed: 6000, cssEase: 'ease-in-out', fade: true, speed: 2000, pauseOnHover: false }); $el.parent().find('.loading-content').addClass('disable'); }, 500); }) }) } // Sticky Elements $.fn.stickyEl = function () { var $stickyNav, $stickyForm, offset = $('#mainSliderWrapper').length ? $('#mainSliderWrapper').height() : 0, stickyNavHeight = 98, headerContentPad = 9; if ($.cookie('closePanel') == 'closed') { setTimeout(function () { var shiftY = (stickyNavHeight - headerContentPad * 2 - $('.header-content').height()) * -1 - 2; $('.js-quickLinks').css({ 'transform': 'translateY(' + shiftY + 'px)' }) $('.js-quickLinks').addClass('closed') }, 500); } $.fn.stickyEl.init = function () { if (windowWidth > templateOption.mobileMenuBreikpont) { if ($('.js-quickLinks').length) { $('.js-quickLinks').removeClass('stuck'); $stickyForm = new Waypoint.Sticky({ element: $('.js-quickLinks')[0], offset: -offset, handler: function(direction) { if (direction === 'down') { $('.js-quickLinks').css({ 'opacity': 0 }) setTimeout(function () { if ($.cookie('closePanel') == 'closed'){ var shiftY = (stickyNavHeight - $('.header-content').outerHeight()) * -1 - 2; $('.js-quickLinks').css({ 'transform': 'translateY(' + shiftY + 'px)', 'opacity': 1 }) } else { var shiftY = $('.header-content').outerHeight() - 2; $('.js-quickLinks').css({ 'transform': 'translateY(' + shiftY + 'px)', 'opacity': 1 }) } }, 1000); } else { $('.js-quickLinks').css({ 'transform': '' }) } } }) } } else { $('.js-quickLinks').addClass('stuck'); } if (windowWidth > templateOption.mobileMenuBreikpont) { if ($('.header-content').length) { $stickyNav = new Waypoint.Sticky({ element: $('.header-content')[0], offset: -48, handler: function(direction) { $('body').toggleClass('stickNav') } }) } } else { if ($('.header-content').length) { $stickyNav = new Waypoint.Sticky({ element: $('.header-content')[0], offset: -35, handler: function(direction) { $('body').toggleClass('stickNav') } }) } } } this.stickyEl.init(); $.fn.stickyEl.destroy = function () { $('body').removeClass('stickNav'); if ($stickyNav) { $stickyNav.destroy(); } if ($stickyForm) { $stickyForm.destroy(); } } $('.js-quickLinks-open').on('click touchstart', function (e) { e.preventDefault(); if ($stickyForm) { var shiftY = $('.header-content').outerHeight() - 2; $('.js-quickLinks').css({ 'transform': 'translateY(' + shiftY + 'px)' }).removeClass('closed'); $.cookie("closePanel", null, { path: '/' }); } }) $('.js-quickLinks-close').on('click touchstart', function (e) { e.preventDefault(); if ($stickyForm) { var shiftY = 0 - $('.js-quickLinks').height() + $('.header-content').outerHeight() - 2; $('.js-quickLinks').css({ 'transform': 'translateY(' + shiftY + 'px)' }) } $.cookie('closePanel', 'closed', { expires: 1, path: '/' }); setTimeout(function () { $('.js-quickLinks').addClass('closed') }, 500); }) } // Count To function count(options) { var $this = $(this); options = $.extend({}, options || {}, $this.data('countToOptions') || {}); $this.countTo(options); } // number counter if (blocks.counterBlock.length) { blocks.counterBlock.each(function () { var $this = $(this); $this.waypoint(function () { $('.counter-box-number > span', $this).each(count); $this.addClass('counted') this.destroy(); }, { triggerOnce: true, offset: '80%' }); }) } // Slick Carousels Start if (blocks.serviceBoxRotator.length) { blocks.serviceBoxRotator.slick({ mobileFirst: false, slidesToShow: 1, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 1800, arrows: false, dots: false, fade: true, responsive: [{ breakpoint: 575, settings: { dots: true } }] }); } if (blocks.servicesCarousel.length) { blocks.servicesCarousel.slick({ mobileFirst: false, slidesToShow: 1, slidesToScroll: 1, infinite: false, arrows: false, dots: true, autoplay: true, autoplaySpeed: 4000, speed: 1600, pauseOnHover: false }); blocks.servicesCarousel.slick('slickPause'); blocks.servicesCarousel.waypoint({ offset: 500, handler: function () { $(this.element).slick('slickPlay'); this.destroy(); } }); } if (blocks.icnCarousel.length) { slickicnCarousel(); } // icon carousel function slickicnCarousel() { if (blocks.icnCarousel.hasClass('slick-initialized')) { blocks.icnCarousel.slick('unslick'); } else { if ($(window).width() > 768) { blocks.icnCarousel.slick({ //slidesToShow: 3, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 5000, speed: 1200, arrows: false, dots: true, pauseOnHover: false, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 2 } }] }); } } } if (blocks.counterCarousel.length) { blocks.counterCarousel.slick({ slidesToShow: 4, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 5000, speed: 1200, arrows: false, dots: true, pauseOnHover: false, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 4 } }, { breakpoint: 767, settings: { slidesToShow: 2 } }, { breakpoint: 575, settings: { slidesToShow: 1 } }] }); blocks.counterCarousel.slick('slickPause'); blocks.counterCarousel.waypoint({ offset: 500, handler: function () { $(this.element).slick('slickPlay'); this.destroy(); } }); } if (blocks.specialistCarousel.length) { blocks.specialistCarousel.slick({ slidesToShow: 3, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 5000, speed: 1200, arrows: false, dots: true, pauseOnHover: false, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 3 } }, { breakpoint: 992, settings: { slidesToShow: 2 } }, { breakpoint: 575, settings: { slidesToShow: 1 } }] }); blocks.specialistCarousel.slick('slickPause'); blocks.specialistCarousel.waypoint({ offset: 500, handler: function () { $(this.element).slick('slickPlay'); this.destroy(); } }); } if (blocks.icnAltCarousel.length) { blocks.icnAltCarousel.slick({ slidesToShow: 3, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 5000, speed: 1200, arrows: false, dots: true, pauseOnHover: false, responsive: [ { breakpoint: 767, settings: { slidesToShow: 2 } }, { breakpoint: 575, settings: { slidesToShow: 1 } }] }); } if (blocks.specialCarousel.length) { blocks.specialCarousel.slick({ mobileFirst: false, slidesToShow: 2, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 3500, arrows: false, dots: true, speed: 1500, pauseOnHover: false, responsive: [ { breakpoint: 575, settings: { slidesToShow: 1 } }] }); blocks.specialCarousel.slick('slickPause'); blocks.specialCarousel.waypoint({ offset: 500, handler: function () { $(this.element).slick('slickPlay'); this.destroy(); } }); } if (blocks.reviewsCarousel.length) { blocks.reviewsCarousel.slick({ mobileFirst: false, slidesToShow: 1, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 5000, arrows: true, dots: false, speed: 1200, responsive: [ { breakpoint: 992, settings: { arrows: false, dots: true, } }] }); blocks.reviewsCarousel.slick('slickPause'); blocks.reviewsCarousel.waypoint({ offset: 500, handler: function () { $(this.element).slick('slickPlay'); this.destroy(); } }); } if (blocks.singleCarousel.length) { blocks.singleCarousel.slick({ mobileFirst: false, slidesToShow: 1, slidesToScroll: 1, infinite: true, arrows: true, fade: true, autoplay: true, autoplaySpeed: 3000, pauseOnHover: false }); blocks.singleCarousel.slick('slickPause'); blocks.singleCarousel.waypoint({ offset: 500, handler: function () { $(this.element).slick('slickPlay'); this.destroy(); } }); } if (blocks.postCarousel.length) { blocks.postCarousel.slick({ mobileFirst: false, slidesToShow: 1, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 4000, arrows: true, dots: false }); } if (blocks.galleryHoverCarousel.length) { blocks.galleryHoverCarousel.slick({ mobileFirst: false, slidesToShow: 1, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 4000, speed: 1500, arrows: false, dots: true }); } if (blocks.singleServiceCarousel.length) { blocks.singleServiceCarousel.slick({ mobileFirst: false, slidesToShow: 1, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 8000, speed: 2500, arrows: true, dots: true, responsive: [ { breakpoint: 1024, settings: { arrows: false, adaptiveHeight: true } }] }); } if (blocks.blogCarousel.length) { blocks.blogCarousel.slick({ slidesToShow: 2, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 5000, arrows: false, dots: true, responsive: [ { breakpoint: 767, settings: { slidesToShow: 1 } }] }); } if (blocks.blogCarouselFull.length) { blocks.blogCarouselFull.slick({ slidesToShow: 3, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 5000, speed: 1500, arrows: false, dots: true, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 2 } }, { breakpoint: 575, settings: { slidesToShow: 1 } }] }); } if (blocks.testimonialCarousel.length) { blocks.testimonialCarousel.slick({ mobileFirst: false, slidesToShow: 1, slidesToScroll: 1, infinite: true, autoplay: true, arrows: false, autoplaySpeed: 5000, speed: 1500, dots: true }); } if (blocks.reviewsTextCarousel.length) { blocks.reviewsTextCarousel.slick({ mobileFirst: false, slidesToShow: 1, slidesToScroll: 1, infinite: true, autoplay: true, arrows: false, autoplaySpeed: 6000, speed: 1500, dots: false }); } if (blocks.service2Carousel.length) { blocks.service2Carousel.slick({ slidesToShow: 3, slidesToScroll: 1, infinite: true, autoplay: true, autoplaySpeed: 5000, speed: 1200, arrows: false, dots: true, pauseOnHover: false, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 2 } }, { breakpoint: 575, settings: { slidesToShow: 1 } }] }); } // Slick Carousels End // Post Isotope if (blocks.postGallery.length) { var $postgallery = $('.blog-isotope'); $postgallery.imagesLoaded(function () { $postgallery.isotope({ itemSelector: '.blog-post', masonry: { gutter: 30, columnWidth: '.blog-post' } }); setTimeout(function () { $postgallery.parent('.gallery-wrap').addClass('loaded'); }, 500); }); } // Isotope Gallery if (blocks.isotopeGallery.length) { var $gallery = blocks.isotopeGallery; $gallery.imagesLoaded(function () { $gallery.isotope({ itemSelector: '.gallery-item', masonry: { columnWidth: '.gallery-item', gutter: 30 } }); setTimeout(function () { $gallery.isotope('layout'); $gallery.parent('.gallery-wrap').addClass('loaded'); }, 500); }); isotopeFilters($gallery); } // Isotope Filters (for Gallery Page) function isotopeFilters(gallery) { var $gallery = $(gallery); if ($gallery.length) { var container = $gallery; var optionSets = $(".filters-by-category .option-set"), optionLinks = optionSets.find("a"); optionLinks.on('click', function (e) { var thisLink = $(this); if (thisLink.hasClass("selected")) return false; var optionSet = thisLink.parents(".option-set"); optionSet.find(".selected").removeClass("selected"); thisLink.addClass("selected"); var options = {}, key = optionSet.attr("data-option-key"), value = thisLink.attr("data-option-value"); value = value === "false" ? false : value; options[key] = value; if (key === "layoutMode" && typeof changeLayoutMode === "function") changeLayoutMode($this, options); else { container.isotope(options); } return false }) } } // Syncronized Gallery function sliderGallery(main, thumbs) { $(main).slick({ slidesToShow: 1, slidesToScroll: 1, fade: true, asNavFor: thumbs }); $(thumbs).slick({ slidesToShow: 5, slidesToScroll: 1, asNavFor: main, centerMode: false, focusOnSelect: true, infinite: true, arrows: true, responsive: [ { breakpoint: 1024, settings: { slidesToShow: 4 } }, { breakpoint: 768, settings: { slidesToShow: 4 } }, { breakpoint: 575, settings: { slidesToShow: 3 } }] }); } // popover Gallery function popoverGallery() { $('.gallery-popover-link').on('mouseover', function () { $(this).closest('.container').find('.gallery-popover-link').not($(this)).addClass('darken') }).on('mouseleave', function () { $(this).closest('.container').find('.gallery-popover-link').removeClass('darken') }) $('.gallery-popover-link').popover({ html: true, placement: 'right', trigger: 'hover', delay: { "show": 100, "hide": 0 }, offset: $(this).height(), template: '