Problem With Paralax Effect Continued ... - Question | JoomShaper
SP Page Builder 6 is Here! Learn More →

Problem With Paralax Effect Continued ...

T

Tomasz Michałowski

SP Page Builder 4 years ago

there is always a problem with Paralax effect background. Empty space appears when scrolling the page when the screen is vertical. browsers: computer : chrome, firefox, ie ... smartphone : android

video: https://cdx.pl/parallax.webm

0
7 Answers
Toufiq
Toufiq
Accepted Answer
Senior Staff 4 years ago #9367

Hi there,

Thanks for contacting us. Your administrator access does not work. Even it does not show any error while i try to login.

-Thanks

0
T
Tomasz Michałowski
Accepted Answer
4 years ago #9371

I checked it works.

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 4 years ago #9429

It does not work for me :(

0
T
Tomasz Michałowski
Accepted Answer
4 years ago #9430

maybe on this page

0
T
Tomasz Michałowski
Accepted Answer
4 years ago #9464

I found my own solution - code below. I am begging you to do it in your own script or write where the function is Parallax- in what file. the problem is concerned background Position

$('[data-sppb-parallax]').each(function() { $(this).removeAttr('data-sppb-parallax'); $(this).addClass('js-parallax-bg'); });

var images = [].slice.call(document.querySelectorAll('.js-parallax-bg'));

function getViewportHeight() { var a = document.documentElement.clientHeight, b = window.innerHeight; return a < b ? b : a; }

function getViewportScroll() { if(typeof window.scrollY != 'undefined') { return window.scrollY; } if(typeof pageYOffset != 'undefined') { return pageYOffset; } var doc = document.documentElement; doc = doc.clientHeight ? doc : document.body; return doc.scrollTop; }

function doParallax() { var el, elOffset, elHeight, offset = getViewportScroll(), vHeight = getViewportHeight();

for(var i in images) {
    el = images[i];
    elOffset = el.offsetTop;
    elHeight = el.offsetHeight;

    if((elOffset > offset + vHeight) || (elOffset + elHeight < offset)) { continue; }
    pos_par = Math.round((elOffset - offset)*3/5);

if(pos_par>0){ el.style.backgroundPosition = '50% '+pos_par+'px'; }

}

}

$(window).scroll(function () { doParallax() })

0
T
Tomasz Michałowski
Accepted Answer
4 years ago #9700

has the fault been repaired?

0
Toufiq
Toufiq
Accepted Answer
Senior Staff 4 years ago #9888

Hi there, I have forward your ticket to our developer team. I hope they will take care your issue. Thanks

0