cameronmcefee / plax

JQuery powered parallaxing
http://www.cameronmcefee.com/plax
MIT License
2.28k stars 206 forks source link

Plax on elements loaded via ajax #38

Closed hjujah closed 11 years ago

hjujah commented 11 years ago

Hi, I can't make plax to work on elements loaded via ajax.

On document ready I have this code: $('.plax').plaxify(); $.plax.enable({ "activityTarget": $('footer')});

Then before my ajax call i have this: $.plax.disable(true);

And when the content is loaded i call again: $.plax.enable({ "activityTarget": $('footer')});

Note:Ajax function completely destroys old plax elements and render new ones. Please can you advise? What am I doing wrong? Thanks in advance.for your answer!

cameronmcefee commented 11 years ago

Hi @hjujah,

Since you're removing the plaxed elements from the DOM entirely, they're removed from Plax too. My guess is you'll want to do $('.plax').plaxify(); again (or on whatever your new content is) to be sure you add the new content before you call $.plax.enable again.

hjujah commented 11 years ago

Thanks a lot for the tip! Great plugin, btw... I love it

cameronmcefee commented 11 years ago

Thanks! I'm glad you find it useful.