Files
damuyunHome/js/main.js
2024-07-04 15:22:53 +08:00

446 lines
9.1 KiB
JavaScript

(function($) {
"use strict";
// meanmenu
jQuery("#mobile-menu").meanmenu({
meanMenuContainer: ".mobile-menu",
meanScreenWidth: "992"
});
$(".info-bar").on("click", function() {
$(".extra-info").addClass("info-open");
});
$(".close-icon").on("click", function() {
$(".extra-info").removeClass("info-open");
});
$("[data-background]").each(function () {
$(this).css("background-image", "url(" + $(this).attr("data-background") + ")")
})
// slider - active
function mainSlider() {
var BasicSlider = $(".slider-active");
BasicSlider.on("init", function(e, slick) {
var $firstAnimatingElements = $(".single-slider:first-child").find(
"[data-animation]"
);
doAnimations($firstAnimatingElements);
});
BasicSlider.on("beforeChange", function(e, slick, currentSlide, nextSlide) {
var $animatingElements = $(
'.single-slider[data-slick-index="' + nextSlide + '"]'
).find("[data-animation]");
doAnimations($animatingElements);
});
BasicSlider.slick({
autoplay: false,
autoplaySpeed: 10000,
dots: true,
fade: true,
arrows: false,
responsive: [
{ breakpoint: 767, settings: { dots: false, arrows: false } }
]
});
function doAnimations(elements) {
var animationEndEvents =
"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend";
elements.each(function() {
var $this = $(this);
var $animationDelay = $this.data("delay");
var $animationType = "animated " + $this.data("animation");
$this.css({
"animation-delay": $animationDelay,
"-webkit-animation-delay": $animationDelay
});
$this.addClass($animationType).one(animationEndEvents, function() {
$this.removeClass($animationType);
});
});
}
}
mainSlider();
// blog - active
$(".blog-active").slick({
dots: true,
arrows: false,
infinite: true,
speed: 300,
slidesToShow: 3,
slidesToScroll: 3,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: true
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
// testimonial-active
$(".testimonial-active").slick({
dots: true,
arrows: false,
infinite: true,
speed: 300,
slidesToShow: 1,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
dots: false
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
dots: false
}
}
]
});
// testimonial-active
$(".testimonial-bg").slick({
dots: false,
arrows: false,
infinite: true,
speed: 300,
slidesToShow: 1,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
dots: false
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
dots: false
}
}
]
});
// testimonial-active
$(".testimonial-box-active").slick({
dots: true,
arrows: false,
infinite: true,
speed: 300,
slidesToShow: 3,
centerMode: true,
slidesToScroll: 1,
centerPadding: 0,
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 767,
settings: {
slidesToShow: 2,
slidesToScroll: 1,
dots: false
}
},
{
breakpoint: 520,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
dots: false
}
}
]
});
// testimonial-active
$(".brand-active").slick({
dots: false,
arrows: false,
infinite: true,
speed: 300,
slidesToShow: 5,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 4,
slidesToScroll: 1
}
},
{
breakpoint: 768,
settings: {
slidesToShow: 3,
slidesToScroll: 1
}
},
{
breakpoint: 520,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
// testimonial-active
$(".related-project-active").slick({
dots: false,
arrows: false,
infinite: true,
speed: 300,
slidesToShow: 3,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 767,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 520,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
// related-product-active
$(".related-product-active").slick({
dots: false,
arrows: false,
infinite: true,
speed: 300,
slidesToShow: 4,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 4,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 767,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 520,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
// related-product-active
$(".service-active").slick({
dots: true,
arrows: false,
infinite: true,
speed: 300,
slidesToShow: 3,
slidesToScroll: 1,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 1,
infinite: true,
dots: false
}
},
{
breakpoint: 991,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 767,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 520,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
// portfolio active
$(".portfolio-area").imagesLoaded(function() {
var grid = $(".grid").isotope({
itemSelector: ".grid-item",
percentPosition: true,
masonry: {
// use outer width of grid-sizer for columnWidth
columnWidth: ".grid-item"
}
});
$(".portfolio-menu").on("click", "button", function() {
var filterValue = $(this).attr("data-filter");
grid.isotope({ filter: filterValue });
});
//for portfolio menu active class
$(".portfolio-menu button").on("click", function(event) {
$(this)
.siblings(".active")
.removeClass("active");
$(this).addClass("active");
event.preventDefault();
});
});
// magnificPopup
$(".popup-img").magnificPopup({
type: "image",
gallery: {
enabled: true
}
});
/* magnificPopup video view */
$('.popup-video').magnificPopup({
type: 'iframe'
});
// counterUp
$(".counter").counterUp({
delay: 10,
time: 1000
});
// niceSelect
$("select").niceSelect();
// scrollUp
$.scrollUp({
scrollText: '<i class="fas fa-chevron-up"></i>',
scrollSpeed: 900,
animation: "fade"
});
})(jQuery);