jQuery(document).ready(function($) { "use strict"; //Image scaling var ratio = 150/150; $(".gallery-container .item-content").not(".post-gallery-container .item-content").each(function(){ var rpsWidth = $(this).parents(".gallery-container").find(".item-cover").first().width(); var rpsHeight = rpsWidth * ratio; //$(this).find(".item-cover img").width( rpsWidth ); $(this).find(".item-cover img").height( rpsHeight ); $(this).last().addClass( "highlight" ); }); if( $(window).width() > 480 ){ var maxHeight = Math.max.apply(null, $(".section-thumb-excerpt.grid-col-2 .thumb-excerpt-list li, .section-thumb-excerpt.grid-col-3 .thumb-excerpt-list li").map(function () { return $(this).height(); }).get()); $(".section-thumb-excerpt.grid-col-2 .thumb-excerpt-list li, .section-thumb-excerpt.grid-col-3 .thumb-excerpt-list li").height( maxHeight ); } //HeaderPinned if( $(window).width() > 1023 ){ $(window).scroll(function(){ if($(window).scrollTop() >= 250){ $(".header").addClass("head-pinned"); $(".search-box").addClass("search-pinned"); }else{ $(".header").removeClass("head-pinned"); $(".search-box").removeClass("search-pinned"); } }); } //Homepage - Slideshow $(".slideshow-container").hover(function(){ $(".slideshow-container .swiper-button-prev, .slideshow-container .swiper-container-rtl .swiper-button-next").animate({"left":"30px","right":"auto","opacity":"1"},200).show(); $(".slideshow-container .swiper-button-next, .slideshow-container .swiper-container-rtl .swiper-button-prev").animate({"left":"auto","right":"30px","opacity":"1"},200).show(); },function(){ $(".slideshow-container .swiper-button-prev, .slideshow-container .swiper-container-rtl .swiper-button-next").animate({"left":"-80px","right":"auto","opacity":"0"},200); $(".slideshow-container .swiper-button-next, .slideshow-container .swiper-container-rtl .swiper-button-prev").animate({"left":"auto","right":"-80px","opacity":"0"},200); }); var homeSliderSwiper = new Swiper (".slideshow-container", { effect: "fade", direction: "horizontal", centeredSlides: true, simulateTouch: true, parallax:true, pagination: { el: ".home-slider-swiper-pagination", type: "bullets", clickable:true, }, navigation: { nextEl: ".home-slider-swiper-button-next", prevEl: ".home-slider-swiper-button-prev", }, speed: 1200, autoplay: { delay: 5000, }, loop: true }); if( $(".slideshow-container .swiper-slide").length == 1 || $(".slideshow-container .swiper-slide").length == 3 ) { $(".slideshow-container").addClass( "disabled" ); } //Thumblist - ThumbRadio var ptRadio = 0.75; var ptWidth = $(".post-gallery-container .item-content .item-grid-box .attachment img").width(); var ptHeight = ptWidth * ptRadio; $(".post-gallery-container .item-content .item-grid-box .attachment img").height( ptHeight ); //ThumbExcerptlist - ThumbRadio var trRadio = 0.75; var trWidth = 300; var trHeight = trWidth * trRadio; $(".thumb-excerpt-list li .post-thumbnail img").width( trWidth ); $(".thumb-excerpt-list li .post-thumbnail img").height( trHeight ); //ImageDelayAnimation var startDelayTime = 50; var addDelayTime = 50; //ImageDelayAnimation - PostGallery $(".gallery-container").each(function(){ $.each($(this).find(".item-content"), function(index, item) { $(item).attr("data-aos-delay", startDelayTime + index * addDelayTime); }); }); //ImageDelayAnimation - PostExcerptThumb $(".thumb-title-list, .thumb-excerpt-list").each(function(){ $.each($(this).find("li"), function(index, item) { $(item).attr("data-aos-delay", startDelayTime + index * addDelayTime); }); }); //ImageDelayAnimation - GridColumn $(".section-editor ul").each(function(){ $.each($(this).find("li"), function(index, item) { $(item).attr("data-aos", "fade-up"); $(item).attr("data-aos-delay", startDelayTime + index * addDelayTime); }); }); //ImageDelayAnimation - PostImages $(".product-content img").not(".gallery img").each(function(index, item) { $(item).addClass("aos-init aos-animate"); $(item).attr("data-aos", "fade-up"); $(item).attr("data-aos-delay", startDelayTime + index * addDelayTime); }); //ImageDelayAnimation - Gallery $(".gallery").each(function(){ $.each($(this).find(".gallery-item"), function(index, item) { $(item).addClass("aos-init aos-animate"); $(item).attr("data-aos", "fade-up"); $(item).attr("data-aos-delay", startDelayTime + index * addDelayTime); }); }); //Widget | CatCarouselPicPosts var thisGallerySlider = []; $(".cat-carousel-gallery-slider").each(function(i){ var thisGallerySliderID = $(this).attr("id"); var thisPaginationID = $(this).find(".gallery-swiper-pagination").attr("id"); var thisPrevButtonID = $(this).parent().find(".gallery-swiper-button-prev").attr("id"); var thisNextButtonID = $(this).parent().find(".gallery-swiper-button-next").attr("id"); thisGallerySlider[i] = new Swiper("#"+thisGallerySliderID, { effect: "slide", direction: "horizontal", slidesPerView: 1, slidesPerGroup: 1, centeredSlides: false, simulateTouch: true, pagination: { el: "#"+thisPaginationID, type: "bullets", clickable:true, }, navigation: { prevEl: "#"+thisPrevButtonID, nextEl: "#"+thisNextButtonID, }, a11y: { prevSlideMessage: "Prev", nextSlideMessage: "Next", paginationBulletMessage: "{{index}}", }, breakpoints: { 321: { slidesPerView: 2, slidesPerGroup: 2, }, 769: { slidesPerView: 4, slidesPerGroup: 4, }, 1024: { slidesPerView: $(this).data("grid"), slidesPerGroup: $(this).data("group"), } }, speed: 800, autoplay: { delay: $(this).data("delay"), disableOnInteraction: false, }, loop: true }); // // thisSwiper[i].on("slideChange", function () { // console.log("slide "+i+" changed"); // }); }); //Widget | GalleryCarousel $(".pop-gallery-slider br, .pop-gallery-slider p").remove(); $(".pop-gallery-slider").find(".gallery").addClass("swiper-wrapper"); $(".pop-gallery-slider").find(".gallery-item").addClass("swiper-slide"); var thisPOPGallerySlider = []; $(".pop-gallery-slider").each(function(i){ var thisPOPGallerySliderID = $(this).attr("id"); var thisPaginationID = $(this).find(".pop-swiper-pagination").attr("id"); var thisPrevButtonID = $(this).parent().find(".pop-swiper-button-prev").attr("id"); var thisNextButtonID = $(this).parent().find(".pop-swiper-button-next").attr("id"); var thisPOPGalleryGrid = $(this).data("grid"); var thisPOPGalleryGroup = $(this).data("group"); if( thisPOPGalleryGrid >= 1 ){ thisPOPGallerySlider[i] = new Swiper("#"+thisPOPGallerySliderID, { effect: "slide", direction: "horizontal", slidesPerView: thisPOPGalleryGrid, loopedSlides: thisPOPGalleryGrid, slidesPerGroup: thisPOPGalleryGrid, spaceBetween: 0, centeredSlides: false, simulateTouch: true, preloadImages: true, pagination: { el: "#"+thisPaginationID, type: "bullets", clickable:true, }, navigation: { prevEl: "#"+thisPrevButtonID, nextEl: "#"+thisNextButtonID, }, a11y: { prevSlideMessage: "Prev", nextSlideMessage: "Next", paginationBulletMessage: "{{index}}", }, speed: 1200, autoplay: { delay: $(this).data("delay"), disableOnInteraction: false, }, loop: true }); } else { thisPOPGallerySlider[i] = new Swiper("#"+thisPOPGallerySliderID, { effect: "slide", direction: "horizontal", slidesPerView: thisPOPGalleryGrid, loopedSlides: thisPOPGalleryGrid, slidesPerGroup: thisPOPGalleryGrid, spaceBetween: 0, centeredSlides: true, simulateTouch: true, preloadImages: true, pagination: { el: "#"+thisPaginationID, type: "bullets", clickable:true, }, navigation: { prevEl: "#"+thisPrevButtonID, nextEl: "#"+thisNextButtonID, }, a11y: { prevSlideMessage: "Prev", nextSlideMessage: "Next", paginationBulletMessage: "{{index}}", }, speed: 800, /*autoplay: { delay: $(this).data("delay"), disableOnInteraction: false, },*/ loop: true }); } }); //Widget | CatThumbTitlePosts $(".cat-thumb-title-posts").each(function(){ var ttRadio = $(this).find(".section-container").data("radio"); var ttWidth = $(this).find(".post-thumbnail").width(); var ttHeight = ttWidth * ttRadio; $(this).find("img").width( ttWidth ); $(this).find("img").height( ttHeight ); }); //Widget | CatCarouselPicPosts $(".cat-carousel-gallery-posts").each(function(){ var ccgpRadio = $(this).find(".section-container").data("radio"); var ccgpWidth = $(this).find(".thumbnail").width(); var ccgpHeight = ccgpWidth * ccgpRadio; $(this).find("img").width( ccgpWidth ); $(this).find("img").height( ccgpHeight ); }); //Back to top $(window).bind("scroll", function(){ if ($(this).scrollTop() > 200) { $(".back-to-top, .back-to-top-livechat").fadeIn(500).css({display:"inline-block"}); } else { $(".back-to-top, .back-to-top-livechat").fadeOut(500); } }); $(".back-to-top, .back-to-top-livechat").click(function(){ $("html, body").animate({scrollTop: "0px"}, 500); }); //Leave a message $(document).click(function(){ $(".message-form-box .message-form").slideUp("fast"); }); $(".message-form-box").click(function(event){ event.stopPropagation(); }); $(".message-header").click( function(){ $(".message-form-box .message-form").slideToggle("fast"); $(".message-form-box").toggleClass("message-form-box-toggle"); $(".message-form-box .message-header .arrow-toggle i").toggleClass("icon-up icon-down"); } ); });