83 lines
2.5 KiB
JavaScript
83 lines
2.5 KiB
JavaScript
// Scroll to Top
|
|
window.onscroll = function() {
|
|
const halloween_gift_store_button = document.querySelector('.scroll-top-box');
|
|
if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) {
|
|
halloween_gift_store_button.style.display = "block";
|
|
} else {
|
|
halloween_gift_store_button.style.display = "none";
|
|
}
|
|
};
|
|
|
|
document.querySelector('.scroll-top-box a').onclick = function(event) {
|
|
event.preventDefault();
|
|
window.scrollTo({top: 0, behavior: 'smooth'});
|
|
};
|
|
|
|
// Banner slider
|
|
jQuery(document).ready(function () {
|
|
var halloween_gift_store_Slider = new Swiper(".main-slider", {
|
|
slidesPerView: 1,
|
|
speed: 1000,
|
|
loop: true,
|
|
autoplay: {
|
|
delay: 5000,
|
|
disableOnInteraction: false,
|
|
},
|
|
pagination: {
|
|
el: ".main-pagination",
|
|
clickable: true,
|
|
},
|
|
navigation: {
|
|
nextEl: ".main-slider-button-next",
|
|
prevEl: ".main-slider-button-prev",
|
|
},
|
|
grabCursor: true,
|
|
});
|
|
});
|
|
|
|
// Swiper Initializer Function
|
|
jQuery(document).ready(function($) {
|
|
|
|
function halloween_gift_store_initCustomSwiper(containerSelector, ulExtraClass, slideExtraClass, paginationSelector) {
|
|
var $halloween_gift_store_swiperEl = $(containerSelector);
|
|
|
|
if ($halloween_gift_store_swiperEl.find("ul.swiper-wrapper").length) {
|
|
var $halloween_gift_store_ul = $halloween_gift_store_swiperEl.find("ul.swiper-wrapper");
|
|
var $halloween_gift_store_slides = $halloween_gift_store_ul.find("li");
|
|
|
|
// Create new swiper wrapper
|
|
var $halloween_gift_store_wrapper = $("<div class='swiper-wrapper " + ulExtraClass + "'></div>");
|
|
$halloween_gift_store_slides.each(function () {
|
|
var $halloween_gift_store_slide = $("<div class='swiper-slide " + slideExtraClass + "'></div>");
|
|
$halloween_gift_store_slide.html($(this).html());
|
|
$halloween_gift_store_wrapper.append($halloween_gift_store_slide);
|
|
});
|
|
|
|
// Replace old UL with new Swiper wrapper
|
|
$halloween_gift_store_ul.replaceWith($halloween_gift_store_wrapper);
|
|
}
|
|
|
|
// Initialize Swiper
|
|
new Swiper(containerSelector, {
|
|
breakpoints: {
|
|
0: { slidesPerView: 1 },
|
|
600: { slidesPerView: 2 },
|
|
992: { slidesPerView: 3 }
|
|
},
|
|
speed: 1200,
|
|
autoplay: {
|
|
delay: 3000,
|
|
disableOnMulishaction: false,
|
|
},
|
|
spaceBetween: 30,
|
|
pagination: {
|
|
el: paginationSelector,
|
|
clickable: true,
|
|
},
|
|
});
|
|
}
|
|
|
|
// News Slider
|
|
halloween_gift_store_initCustomSwiper(".mySwiper2", "news-box", "news-inner-box", ".news-swiper-pagination");
|
|
});
|