') if($('body').css('--hide-default-scrollbar') && $('body').css('--hide-default-scrollbar').trim() == 'true'){ $('html').addClass('hide-scrollbar') } } function getValue(text, defaultValue){ return (text.match(/\d+/) ? text.match(/\d+/)[0] : defaultValue)/100 } function getDirection(text){ return text.search('reverse') > -1 ? -1 : 1 } function horizontalScroll(scroll, windowWidth, windowHeight, disableMobile){ $('.mdw-horizontal-scroll').each(function(){ var $this = $(this), container = $this.find('.e-con, .e-container').eq(0), containerTop = $this.offset().top, totalWidth = 0, extraWidth = 0, passed = scroll - containerTop, translate = passed, minHeight = $this.css('--min-height') ? $this.css('--min-height') : '100vh' container.children('.elementor-element').each(function(){ totalWidth += $(this).outerWidth() + parseFloat($(this).css('margin-left')) + parseFloat($(this).css('margin-right')) }) if( windowWidth windowWidth){ extraWidth = totalWidth - windowWidth } $this.height('calc(' + minHeight + ' + ' + extraWidth + 'px)') if(passed extraWidth){ translate = extraWidth } var progress = translate/extraWidth if(progress 0 && progress = 1){ $this.removeClass('fixed') $this.addClass('bottom') } container.css('transform', 'translateX(-' + translate + 'px)') $this.css('--progress', progress) if($this.css('--progress-bar') && $this.css('--progress-bar') == 'true'){ $this.removeClass('progress-bar-disabled') }else{ $this.addClass('progress-bar-disabled') } }) } var parallaxUpdate = false function scrollMovement(scroll, windowWidth, windowHeight, disableMobile){ var enableMovement = false if(windowWidth > 0){ enableMovement = !$('body').css('--disable-movement-mobile') || $('body').css('--disable-movement-mobile').trim() != 'true' } if(windowWidth > 767){ enableMovement = !$('body').css('--disable-movement-tablet') || $('body').css('--disable-movement-tablet').trim() != 'true' } if(windowWidth > 1024){ enableMovement = !$('body').css('--disable-movement-desktop') || $('body').css('--disable-movement-desktop').trim() != 'true' } if(enableMovement){ $("[class^='mdw-hs-movement'], [class*=' mdw-hs-movement']").each(function(i){ var $this = $(this), className = $this.attr('class'), element = $this.hasClass('elementor-widget') ? $this.find('.elementor-widget-container') : $this, parent = element.parent(), elementRect = element.get(0).getBoundingClientRect(), parentRect = parent.get(0).getBoundingClientRect(), isHorizontal = $this.closest('.mdw-horizontal-scroll').length, offset = 100, elementVisible = elementRect.right > -1*offset && elementRect.left - windowWidth -1*offset, parentVisible = parentRect.right > -1*offset && parentRect.left - windowWidth -1*offset, hasChild = $this.find("div[class^='mdw-hs-movement'],div[class*=' mdw-hs-movement']").length, totalWidth = parseFloat($this.closest('.mdw-horizontal-scroll').attr('total-width')), parallax $this.css({ '--speed-x': 0, '--speed-y': 0, '--speed-r': 0 }) className.split(' ').forEach(function(c){ if(c.startsWith('mdw-hs-movement-translate-x')){ $this.css('--speed-x', getValue(c, 10)) $this.css('--direction-x', getDirection(c)) } if(c.startsWith('mdw-hs-movement-translate-y')){ $this.css('--speed-y', getValue(c, 10)) $this.css('--direction-y', getDirection(c)) } if(c.startsWith('mdw-hs-movement-rotate')){ $this.css('--speed-r', getValue(c, 10)) $this.css('--direction-r', getDirection(c)) } }) if( windowWidth totalWidth - windowWidth/2){ parallax = - HSRect.top - HSRect.left - totalWidth + windowWidth }else{ parallax = windowWidth/2 - elementRect.left - element.outerWidth()/2 - HSRect.top } }else{ var topPos = Math.round(elementRect.top + scroll + element.outerHeight()/2 - parseFloat(element.css('transform').split(' ')[5])) if(topPos $('body').outerHeight(true) - windowHeight/2){ parallax = scroll - $('body').outerHeight(true) + windowHeight }else{ parallax = windowHeight/2 - element.outerHeight()/2 - elementRect.top } } if(parentVisible || elementVisible || hasChild || parallaxUpdate){ $(this).css('--parallax', parallax) } }) }else{ $("[class^='mdw-hs-movement'], [class*=' mdw-hs-movement']").css('--parallax', 0) } } var currentTime, lastTime function scrollActivity(delayCall=true){ var scroll = $(window).scrollTop(), windowWidth = $(window).width(), windowHeight = $('.mdw-100vh').height(), disableMobile = $('body').css('--disable-horizontal-scroll-mobile') && $('body').css('--disable-horizontal-scroll-mobile') == 'true' lastTime = new Date() setTimeout(function(){ currentTime = new Date() if(currentTime - lastTime > 200 && delayCall){ scrollActivity(false) } },500) horizontalScroll(scroll, windowWidth, windowHeight, disableMobile) scrollMovement(scroll, windowWidth, windowHeight, disableMobile) } function scrollToSection(){ var link = $(this).attr('href') if( link && link != '#' && link[0] == '#' ){ var el = $('.' + link.substr(1)).eq(0), parentHS = el.closest('.mdw-horizontal-scroll'), disableMobile = $('body').css('--disable-horizontal-scroll-mobile') && $('body').css('--disable-horizontal-scroll-mobile') == 'true' if(parentHS.length){ var scrollAmount = parentHS.offset().top + el.offset().left - parentHS.find('.e-con, .e-container').eq(0).offset().left if($(window).width() 2.9 && delVal