Prinzhorn / skrollr

Stand-alone parallax scrolling library for mobile (Android + iOS) and desktop. No jQuery. Just plain JavaScript (and some love).
http://prinzhorn.github.io/skrollr/
MIT License
18.53k stars 3.5k forks source link

Skrollr not working correctly on Ajax content load #787

Closed EvilDonkeyLondon closed 8 years ago

EvilDonkeyLondon commented 8 years ago

I have an element that changes opacity as you scroll and it works fine on first page load. Then the main content from other pages gets pulled with a jquery load() request. When I go back to the page with the element changing the opacity, this doesn't work anymore.

<div class="top-slide" data-200-top="opacity: .9;" data-top-bottom="opacity: 0;" data-stellar-background-ratio="0.9"></div>

Here is the live example http://dev.thinktravellive.com/, the element that changes opacity is the big full width image just below the nav. If you click to another page and then click back to Home, Skrollr don't work anymore on the opacity but the weird thing is that it still (kind of) works on the sticky nav bar.

Thank you

EvilDonkeyLondon commented 8 years ago

I fixed this with destroying and reinitializing skrollr in the ajax callback

skrollr.init().destroy();
s = skrollr.init({forceHeight: false});
Tusko commented 6 years ago

s.refresh();