jQuery(document).ready(function() {
$('.owl-img-slider.owl-carousel').owlCarousel({
loop: true,
margin: 50,
nav: true,
center: true,
// navText: [
// "
←
",
// "→
"
// ],
navText: ["
","
"],
autoplayTimeout: 4000,
smartSpeed: 400,
center: true,
responsive: {
0: {
items: 1
},
576: {
items: 1
},
768: {
items: 3
},
991: {
items: 3
},
1400: {
items: 3
},
1600: {
items: 3
},
2000: {
items: 3
}
}
});
// Handle category button click
$('.category-btn').click(function() {
var category = $(this).data('category');
// Toggle active category button
$('.category-btn').removeClass('active');
$(this).addClass('active');
// Hide post titles for all categories
$('.post-titles').hide();
// Show post titles for the selected category
$('.post-titles[data-category="' + category + '"]').show().first().addClass('active');
});
// Toggle active category button (added this part)
$('.category-btn:first-child').trigger('click'); // Trigger click on the first category button to make it active by default
// JavaScript for tab functionality
const tabs = document.querySelectorAll(".tab");
function tabify(tab) {
const tabList = tab.querySelector(".tab__list");
if (tabList) {
const tabItems = [...tabList.children];
const tabContent = tab.querySelector(".tab__content");
const tabContentItems = [...tabContent.children];
let tabIndex = 0;
tabIndex = tabItems.findIndex((item, index) => {
return [...item.classList].indexOf("is--active") > -1;
});
tabIndex > -1 ? (tabIndex = tabIndex) : (tabIndex = 0);
function setTab(index) {
tabItems.forEach((x, index) => x.classList.remove("is--active"));
tabContentItems.forEach((x, index) => x.classList.remove("is--active"));
tabItems[index].classList.add("is--active");
tabContentItems[index].classList.add("is--active");
}
tabItems.forEach((x, index) =>
x.addEventListener("click", () => setTab(index))
);
setTab(tabIndex);
}
}
tabs.forEach(tabify);
// Upload Form Func
$(document).ready(function() {
// Listen for changes in the file input field
$('input[type="file"]').change(function() {
// Get the selected file name
var fileName = $(this).val().split('\\').pop();
// Create a span element to display the file name
var $fileSpan = $('').text(fileName);
// Remove any previously displayed file names
$('.uploaded-file-name').remove();
// Add a class to the span element for easy removal later
$fileSpan.addClass('uploaded-file-name');
// Append the span element to a container (replace 'your-container-selector' with the appropriate selector)
$('.upload-field').append($fileSpan);
});
});
// End
// Width Container
if ($(window).width() > 1023) {
var body = $("body").outerWidth();
var contain = $(".width-container .elementor-container").innerWidth();
var less = body - contain;
var total = less / 2;
$(".plant-virtual-sec .elementor-container").css('margin-left', total);
$(".timeline-sec2 .elementor-container").css('margin-left', total);
};
const slider = document.querySelector('.jet-hor-timeline-track');
let isDown = false;
let startX;
let scrollLeft;
slider.addEventListener('mousedown', (e) => {
isDown = true;
slider.classList.add('active');
startX = e.pageX - slider.offsetLeft;
scrollLeft = slider.scrollLeft;
});
slider.addEventListener('mouseleave', () => {
isDown = false;
slider.classList.remove('active');
});
slider.addEventListener('mouseup', () => {
isDown = false;
slider.classList.remove('active');
});
slider.addEventListener('mousemove', (e) => {
if(!isDown) return;
e.preventDefault();
const x = e.pageX - slider.offsetLeft;
const walk = (x - startX) * 3; //scroll-fast
slider.scrollLeft = scrollLeft - walk;
console.log(walk);
});
});
// jQuery(document).ready(function() {
// jQuery(".our-work-menu .raven-link-item").click(function () {
// jQuery(".our-work-menu .raven-link-item").removeClass("active");
// jQuery(this).addClass("active");
// });
// });
// jQuery(document).ready(function($) {
// var sectionTop = $('.stickyy').offset().top;
// var navMenu = $('.our-work-menu');
// $(window).scroll(function() {
// if ($(window).scrollTop() > sectionTop) {
// navMenu.addClass('sticky');
// } else {
// navMenu.removeClass('sticky');
// }
// });
// });
jQuery(document).ready(function ($) {
var owl = $(".qa-slider .owl-carousel");
owl.owlCarousel({
items: 1,
margin: 20,
loop: false,
nav: true,
dots: true,
dotsData: true,
navText: ["", ""],
responsive: {
768: {
items: 2
}
}
});
jQuery('.our-work-menu .raven-adnav-menu .submenu li .raven-link-item').on('click', function() {
jQuery(this).parent().addClass('active').siblings().removeClass('active');
});
});
$(function() {
var owl = $(".slider-1-widget .owl-carousel");
owl.owlCarousel({
items: 3,
margin: 20,
loop: true,
center: true,
nav: true,
// navText: [
// "←
",
// "→
"
// ],
navText: ["
","
"],
responsive: {
0: {
items: 1
},
768: {
items: 3
}
}
});
});
$(function() {
var owl = $(".slider-2-widget .owl-carousel");
owl.owlCarousel({
items: 4,
margin: 40,
loop: true,
nav: true,
stagePadding: 40,
navText: ["
","
"],
responsive: {
0: {
items: 1,
margin: 10,
stagePadding: 10
},
576: {
items: 2,
margin: 20,
stagePadding: 20
},
768: {
items: 3,
margin: 30,
stagePadding: 29
},
1024: {
items: 4,
margin: 40
}
}
});
});
jQuery(document).ready(function ($) {
setTimeout(function () {
$('.left ul li:first-child').trigger('click');
}, 1000);
$('.home_tab_3 .left ul li').on('click', function () {
$('.home_tab_3 .left ul li').removeClass('active');
$('../wp-content/themes/jupiterx-child/assets/js/.home_tab_3 .right .item').removeClass('active');
var index = $(this).data('index');
$('.right .item:nth-child(' + index + '), .left ul li:nth-child(' + index + ')').addClass('active');
});
});
jQuery(document).ready(function ($) {
$(".translator_btn").on("click", function () {
$(".translator").toggle();
});
});
jQuery(document).ready(function ($) {
$(".mobile_translator_btn").on("click", function () {
$(".mobile_translator").toggle();
});
});
$(function() {
var owl = $(".slider-4 .owl-carousel");
owl.owlCarousel({
items: 2,
margin: 20,
loop: true,
nav: true,
stagePadding: 20,
navText: ["
","
"],
responsive: {
0: {
items: 1,
stagePadding: 20,
},
768: {
items: 1,
stagePadding: 20,
},
1024: {
items: 2
}
}
});
});
$(".raven-nav-menu-toggle").click(function(){
$(".raven-nav-menu-toggle").toggleClass("hamberg-active");
});
$elem1 = $('.btn-class-curve');
var scrollState = 'top';
$(window).scroll(function(){
var scrollPos = $(window).scrollTop();
if( ( scrollPos != 50 ) && ( scrollState === 'top' ) ) {
$elem1.stop().animate({right: '30px'}, 1000);
scrollState = 'scrolled';
}
else if( ( scrollPos === 0 ) && ( scrollState === 'scrolled' ) ) {
$elem1.stop().animate({right: '-400px'}, 1000);
scrollState = 'top';
}
});
// gsap.to('.contact-float-btn', {
// y: () => {
// const buttonHeight = document.querySelector('.contact-float-btn').offsetHeight;
// const scrollHeight = document.body.scrollHeight - window.innerHeight;
// return scrollHeight > 0 ? scrollHeight - buttonHeight : 0;
// },
// ease: "none",
// scrollTrigger: {
// trigger: "body",
// start: "top top",
// end: "bottom bottom",
// scrub: true
// }
// });