(function ($) { 'use strict'; let device_width = window.innerWidth; gsap.registerPlugin(ScrollTrigger); var invJs = { m: function (e) { invJs.d(); invJs.methods(); }, d: function (e) { this._window = $(window), this._document = $(document), this._body = $('body'), this._html = $('html') }, methods: function (e) { invJs.shapeMove(); invJs.sideBarTwoshow(); invJs.afterBefore(); invJs.backtotopLeft(); invJs.autoslidertab(); invJs.odoMeter(); invJs.portfoliobounceAnimation(); invJs.preloader(); invJs.masonryActivation(); invJs.wowActivation(); invJs.headerTopActivation(); invJs.headerSticky(); invJs.salActive(); invJs.magnifyPopup(); invJs.popupMobileMenu(); invJs.slickSliderActivation(); invJs.radialProgress(); invJs.radialProgressOne(); invJs.contactForm(); invJs.menuCurrentLink(); invJs.counterJumpanimation(); invJs.tmpImageRevel(); invJs.gsapAnimationImageScale(); invJs.scrollingText(); invJs.fonklsAnimation(); invJs.animationOnHover(); invJs.jaraLux(); invJs.searchOpton(); invJs.lightBoxJs(); invJs.imageSlideGsap(); invJs.preloaderWithBannerActivation(); invJs.ursorAnimate(); invJs.stickyTopelements(); invJs.dateUpdate(); invJs.smoothScroll(); invJs.onepageMultipage(); // new updates js invJs.gridMask(); invJs.gymTabs(); invJs.positionStickyJs(); }, shapeMove: function(){ $('.shape-move').mousemove(function(e){ var wx = $(window).width(); var wy = $(window).height(); var x = e.pageX - this.offsetLeft; var y = e.pageY - this.offsetTop; var newx = x - wx/2; var newy = y - wy/2; $('.shape-image .shape').each(function(){ var speed = $(this).attr('data-speed'); if($(this).attr('data-revert')) speed *= -1; TweenMax.to($(this), 1, {x: (1 - newx*speed), y: (1 - newy*speed)}); }); }); }, sideBarTwoshow: function () { // Cart Bar show & hide $(document).on('click', '.dot-btn', function () { $(".inverweb-side-bar-close").addClass("show"); $("#anywhere-home").addClass("bgshow"); }); $(document).on('click', '.close-icon-menu', function () { $(".inverweb-side-bar-close").removeClass("show"); $("#anywhere-home").removeClass("bgshow"); }); $(document).on('click', '#anywhere-home', function () { $(".inverweb-side-bar-close").removeClass("show"); $("#anywhere-home").removeClass("bgshow"); }); $(function () { $(".button").on("click", function () { var $button = $(this); var $parent = $button.parent(); var oldValue = $parent.find('.input').val(); if ($button.text() == "+") { var newVal = parseFloat(oldValue) + 1; } else { // Don't allow decrementing below zero if (oldValue > 1) { var newVal = parseFloat(oldValue) - 1; } else { newVal = 1; } } $parent.find('a.add-to-cart').attr('data-quantity', newVal); $parent.find('.input').val(newVal); }); }); }, afterBefore: function () { $(document).ready(function () { if ($(".comparison-slider")[0]) { let compSlider = $(".comparison-slider"); compSlider.each(function () { let compSliderWidth = $(this).width() + "px"; $(this).find(".resize img").css({ width: compSliderWidth }); drags($(this).find(".divider"), $(this).find(".resize"), $(this)); }); $(window).on("resize", function () { let compSliderWidth = compSlider.width() + "px"; compSlider.find(".resize img").css({ width: compSliderWidth }); }); } }); function drags(dragElement, resizeElement, container) { let touched = false; window.addEventListener('touchstart', function () { touched = true; }); window.addEventListener('touchend', function () { touched = false; }); dragElement.on("mousedown touchstart", function (e) { dragElement.addClass("draggable"); resizeElement.addClass("resizable"); //create vars let startX = e.pageX ? e.pageX : e.originalEvent.touches[0].pageX; let dragWidth = dragElement.outerWidth(); let posX = dragElement.offset().left + dragWidth - startX; let containerOffset = container.offset().left; let containerWidth = container.outerWidth(); let minLeft = containerOffset + 10; let maxLeft = containerOffset + containerWidth - dragWidth - 10; dragElement.parents().on("mousemove touchmove", function (e) { if (touched === false) { e.preventDefault(); } let moveX = e.pageX ? e.pageX : e.originalEvent.touches[0].pageX; let leftValue = moveX + posX - dragWidth; if (leftValue < minLeft) { leftValue = minLeft; } else if (leftValue > maxLeft) { leftValue = maxLeft; } let widthValue = (leftValue + dragWidth / 2 - containerOffset) * 100 / containerWidth + "%"; $(".draggable").css("left", widthValue).on("mouseup touchend touchcancel", function () { $(this).removeClass("draggable"); resizeElement.removeClass("resizable"); }); $(".resizable").css("width", widthValue); }).on("mouseup touchend touchcancel", function () { dragElement.removeClass("draggable"); resizeElement.removeClass("resizable"); }); }).on("mouseup touchend touchcancel", function (e) { dragElement.removeClass("draggable"); resizeElement.removeClass("resizable"); }); } }, backtotopLeft: function () { jQuery(function ($) { var scrollTrigger = 100; // show for scroll tiggers var shown = false; function backToTopHandler() { var scrollTop = $(window).scrollTop(); // Show / Hide elements if (scrollTop > scrollTrigger && !shown) { $('.show-on-scroll').addClass('show').removeClass('hide'); shown = true; } if (scrollTop <= scrollTrigger && shown) { $('.show-on-scroll').addClass('hide').removeClass('show'); shown = false; } // Scroll progress (max height = 100px) var pageHeight = $(document).height() - $(window).height(); var progress = (scrollTop / pageHeight) * 100; // % progress var maxHeight = 100; // px var barHeight = (progress / 100) * maxHeight; $(".scrollbar-v").css("height", barHeight + "px"); } // Scroll to top click (float-text + scrollbar-v) $('.float-text a, .scrollbar-v').on('click', function (e) { e.preventDefault(); $('html, body').stop(true).animate({ scrollTop: 0 }, 700); }); // Scroll listener $(window).on('scroll', backToTopHandler); }); }, autoslidertab: function () { $(document).ready(function(){ function tabChange() { var tabs = $(".nav-tabs.splash-nav-tabs > li"); var active = tabs.find("a.active"); var next = active.parent("li").next("li").find("a"); if (next.length === 0) { next = tabs.first().find("a").on("click"); } next.tab("show"); } var tabCycle = setInterval(tabChange, 5000); }) $(document).ready(function(){ function tabChange() { var tabs = $(".progress-tabs-activation .nav-tabs .nav-link"); var active = $(".progress-tabs-activation .nav-tabs .nav-link.active"); var next = active.next(".progress-tabs-activation .nav-link"); // when tab item end it will start form 1st if (next.length === 0) { next = tabs.first(); } next.tab("show"); } // Change after 5 second var tabCycle = setInterval(tabChange, 5000); }) }, portfoliobounceAnimation: function () { if (device_width > 991) { // each wrapper loop document.querySelectorAll(".tmp_jump_animation-wrapper").forEach(wrapper => { let jump_items = wrapper.querySelectorAll(".tmp-jump__item"); if (jump_items.length) { gsap.set(jump_items, { opacity: 0, scale: 1.15, rotation: 0 }); gsap.to(jump_items, { scrollTrigger: { trigger: wrapper, // every wrapper diffrent trigger start: "top 95%" }, opacity: 1, scale: 1, duration: 1, ease: "bounce", stagger: 0.3, rotation: 0 }); } }); } }, radialProgressOne: function () { function radial_animate() { $('svg.radial-progress').each(function (index, value) { $(this).find($('circle.bar--animated')).removeAttr('style'); // Get element in Veiw port var elementTop = $(this).offset().top; var elementBottom = elementTop + $(this).outerHeight(); var viewportTop = $(window).scrollTop(); var viewportBottom = viewportTop + $(window).height(); if (elementBottom > viewportTop && elementTop < viewportBottom) { var percent = $(value).data('countervalue'); var radius = $(this).find($('circle.bar--animated')).attr('r'); var circumference = 2 * Math.PI * radius; var strokeDashOffset = circumference - ((percent * circumference) / 100); $(this).find($('circle.bar--animated')).animate({ 'stroke-dashoffset': strokeDashOffset }, 2800); } }); } // To check If it is in Viewport var $window = $(window); function check_if_in_view() { $('.countervalue').each(function () { if ($(this).hasClass('start')) { var elementTop = $(this).offset().top; var elementBottom = elementTop + $(this).outerHeight(); var viewportTop = $(window).scrollTop(); var viewportBottom = viewportTop + $(window).height(); if (elementBottom > viewportTop && elementTop < viewportBottom) { $(this).removeClass('start'); $('.countervalue').text(); var myNumbers = $(this).text(); if (myNumbers == Math.floor(myNumbers)) { $(this).animate({ Counter: $(this).text() }, { duration: 2800, easing: 'swing', step: function (now) { $(this).text(Math.ceil(now) + '%'); } }); } else { $(this).animate({ Counter: $(this).text() }, { duration: 2800, easing: 'swing', step: function (now) { $(this).text(now.toFixed(2) + '$'); } }); } radial_animate(); } } }); } $window.on('scroll', check_if_in_view); $window.on('load', check_if_in_view); }, preloader: function () { var preload = document.querySelector('#inverweb-load'); if (preload) { var maxTimeout = setTimeout(function () { preload.classList.add("loaded"); }, 2500); window.addEventListener('load', function () { clearTimeout(maxTimeout); preload.classList.add("loaded"); }); } }, masonryActivation: function() { // Run other animations immediately this.initOtherAnimations(); // Wait for window load only for Isotope $(window).on('load', function() { $('.masonary-wrapper-activation').imagesLoaded(function() { var $grid = $('.mesonry-list').isotope({ percentPosition: true, transitionDuration: '0.7s', layoutMode: 'masonry', masonry: { columnWidth: '.resizer', } }); $('.messonry-button').on('click', 'button', function() { var filterValue = $(this).attr('data-filter'); $(this).siblings('.is-checked').removeClass('is-checked'); $(this).addClass('is-checked'); $grid.isotope({ filter: filterValue }); }); // Refresh ScrollTrigger after Isotope ScrollTrigger.refresh(); }); }); }, initOtherAnimations: function() { // Initialize all other animations that don't depend invJs.wowActivation(); // all other animations except masonry }, menuCurrentLink: function () { var currentPage = location.pathname.split("/"), current = currentPage[currentPage.length-1]; $('.mainmenu li a').each(function(){ var $this = $(this); if($this.attr('href') === current){ $this.addClass('active'); $this.parents('.has-menu-child-item').addClass('menu-item-open') } }); }, magnifyPopup: function () { $('.popup-video').magnificPopup({ type: 'iframe' }); }, popupMobileMenu: function (e) { // Open menu $('.hamberger-button').on('click', function (e) { $('.popup-mobile-menu').addClass('active'); }); // Close menu $('.close-menu').on('click', function (e) { $('.popup-mobile-menu').removeClass('active'); $('.popup-mobile-menu .mainmenu .has-droupdown > a, .popup-mobile-menu .mainmenu .with-megamenu > a, .popup-mobile-menu .mainmenu .has-third-lev > a') .siblings('.submenu, .tmp-megamenu') .removeClass('active') .slideUp(400); $('.popup-mobile-menu .mainmenu .has-droupdown > a, .popup-mobile-menu .mainmenu .with-megamenu > a, .popup-mobile-menu .mainmenu .has-third-lev > a') .removeClass('open'); }); // Dropdown toggle (2nd + 3rd level) $('.popup-mobile-menu .mainmenu .has-droupdown > a, .popup-mobile-menu .mainmenu .with-megamenu > a, .popup-mobile-menu .mainmenu .has-third-lev > a') .on('click', function (e) { e.preventDefault(); $(this).siblings('.submenu, .tmp-megamenu') .toggleClass('active') .slideToggle(400); $(this).toggleClass('open'); }); // Close when clicking outside or on onepage nav link $('.popup-mobile-menu, .popup-mobile-menu .mainmenu.onepagenav li a').on('click', function (e) { if (e.target === this) { $('.popup-mobile-menu').removeClass('active'); $('.popup-mobile-menu .mainmenu .has-droupdown > a, .popup-mobile-menu .mainmenu .with-megamenu > a, .popup-mobile-menu .mainmenu .has-third-lev > a') .siblings('.submenu, .tmp-megamenu') .removeClass('active') .slideUp(400); $('.popup-mobile-menu .mainmenu .has-droupdown > a, .popup-mobile-menu .mainmenu .with-megamenu > a, .popup-mobile-menu .mainmenu .has-third-lev > a') .removeClass('open'); } }); }, slickSliderActivation: function () { $('.testimonial-activation').not('.slick-initialized').slick({ infinite: true, slidesToShow: 1, slidesToScroll: 1, dots: true, arrows: true, adaptiveHeight: true, cssEase: 'linear', fade: true, autoplaySpeed: 2000, prevArrow: '', nextArrow: '' }); $('.testimonial-activation-2').not('.slick-initialized').slick({ infinite: true, slidesToShow: 3, slidesToScroll: 1, dots: true, arrows: true, adaptiveHeight: true, cssEase: 'linear', prevArrow: '', nextArrow: '', responsive: [ { breakpoint: 991, settings: { slidesToShow: 2, slidesToScroll: 2 } }, { breakpoint: 769, settings: { slidesToShow: 2, slidesToScroll: 2 } }, { breakpoint: 581, settings: { slidesToShow: 1, slidesToScroll: 1 } } ] }); $('.slider-activation').not('.slick-initialized').slick({ infinite: true, slidesToShow: 1, slidesToScroll: 1, dots: true, arrows: true, adaptiveHeight: true, cssEase: 'linear', fade: true, autoplaySpeed: 2000, prevArrow: '', nextArrow: '' }); $('.slider-activation-2').not('.slick-initialized').slick({ infinite: true, slidesToShow: 1, slidesToScroll: 1, dots: true, arrows: true, adaptiveHeight: true, cssEase: 'linear', fade: true, autoplay: true, autoplaySpeed: 6000, pauseOnHover: false, prevArrow: '', nextArrow: '' }); $('.tmp-banner-right-carousel').not('.slick-initialized').slick({ infinite: true, slidesToShow: 1, slidesToScroll: 1, dots: true, arrows: false, adaptiveHeight: true, cssEase: 'linear', fade: true, autoplay: true, autoplaySpeed: 3000, }); $('.brand-carousel-activation').not('.slick-initialized').slick({ infinite: true, slidesToShow: 6, slidesToScroll: 1, dots: true, arrows: true, adaptiveHeight: true, autoplay: true, autoplaySpeed: 2000, cssEase: 'linear', prevArrow: '', nextArrow: '', responsive: [ { breakpoint: 1199, settings: { slidesToShow: 4, slidesToScroll: 2 } }, { breakpoint: 769, settings: { slidesToShow: 4, slidesToScroll: 2 } }, { breakpoint: 581, settings: { slidesToShow: 3, } }, { breakpoint: 480, settings: { slidesToShow: 2, } }, ] }); $('.brand-carousel-activation-ai').not('.slick-initialized').slick({ infinite: true, slidesToShow: 6, slidesToScroll: 1, dots: true, arrows: true, adaptiveHeight: true, autoplay: true, autoplaySpeed: 2000, cssEase: 'linear', prevArrow: '', nextArrow: '', responsive: [ { breakpoint: 1199, settings: { slidesToShow: 4, slidesToScroll: 2 } }, { breakpoint: 769, settings: { slidesToShow: 4, slidesToScroll: 2 } }, { breakpoint: 581, settings: { slidesToShow: 3, } }, { breakpoint: 480, settings: { slidesToShow: 2, } }, ] }); $('.inner-demo-carousel-activation').not('.slick-initialized').slick({ infinite: true, slidesToShow: 3, slidesToScroll: 1, dots: false, arrows: true, adaptiveHeight: true, autoplay: true, cssEase: 'linear', prevArrow: '', nextArrow: '', responsive: [ { breakpoint: 1199, settings: { slidesToShow: 4, slidesToScroll: 2 } }, { breakpoint: 769, settings: { slidesToShow: 4, slidesToScroll: 2 } }, { breakpoint: 581, settings: { slidesToShow: 3, } }, { breakpoint: 480, settings: { slidesToShow: 2, } }, ] }); }, salActive: function () { sal({ threshold: 0.01, once: true, }); }, headerSticky: function () { // 🔹 Global Sticky Header for all headers $(window).scroll(function () { if ($(this).scrollTop() > 250) { $('.header-sticky').addClass('sticky'); } else { $('.header-sticky').removeClass('sticky'); } }); // 🔹 Extra Padding Only for header-top-padding header $(window).scroll(function () { var $header = $('.header-sticky.header-sticky-smooth'); if ($header.length) { if ($(this).scrollTop() > 250) { var headerHeight = $header.outerHeight(); $('body').css('padding-top', headerHeight + 'px'); } else { $('body').css('padding-top', '0'); } } }); }, wowActivation: function () { new WOW().init(); }, headerTopActivation: function () { $('.bgsection-activation').on('click', function () { $('.header-top-news').addClass('deactive') }) }, radialProgress: function () { $('.radial-progress').waypoint(function () { $('.radial-progress').easyPieChart({ lineWidth: 20, scaleLength: 0, rotate: 0, trackColor: false, lineCap: 'round', size: 220 }); }, { triggerOnce: true, offset: 'bottom-in-view' }); }, contactForm: function () { $('.tmp-dynamic-form').on('submit', function (e) { e.preventDefault(); var _self = $(this); var __selector = _self.closest('input,textarea'); _self.closest('div').find('input,textarea').removeAttr('style'); _self.find('.error-msg').remove(); _self.closest('div').find('button[type="submit"]').attr('disabled', 'disabled'); var data = $(this).serialize(); $.ajax({ url: 'mail.php', type: "post", dataType: 'json', data: data, success: function (data) { _self.closest('div').find('button[type="submit"]').removeAttr('disabled'); if (data.code == false) { _self.closest('div').find('[name="' + data.field + '"]'); _self.find('.tmp-btn').after('
*' + data.err + '
' + data.success + '