Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interfering scripts #30

Closed
gabriellewee opened this issue Feb 25, 2011 · 3 comments
Closed

Interfering scripts #30

gabriellewee opened this issue Feb 25, 2011 · 3 comments

Comments

@gabriellewee
Copy link

I'm working on a Tumblr theme that utilizes your infinite-scroll, David DeSandro's Masonry, and a script to format Youtube videos. I've gotten both Masonry and infinite-scroll to play nice with each other, but something's odd with the loaded posts. The audio post player doesn't work and the Youtube script doesn't work for the video posts. Is there any way I can get all three scripts to work with each other?

Theme: http://glw.tumblr.com

Youtube script: http://static.tumblr.com/imovwvl/RFplh5btp/youtube.js

<script type="text/javascript"> $(window).load(function() { var $wall = $('#posts'); $wall.masonry({ itemSelector: '.post' }); ``` $wall.infinitescroll({ navSelector : '#pag', nextSelector : '#pag .right a', itemSelector : '.post', debug : false }, function( newElement ) { setTimeout(function() { $wall.masonry({ appendedContent: $( newElement ) }); }, 1000); } ); }); ``` </script>
@paulirish
Copy link
Contributor

Any plugin that relies on script tags after every post or document.write won't work with infinite scroll.

typically the other scripts need to reinitialize any new elements added into the page.. doing that is very unique to each script.

@gabriellewee
Copy link
Author

Ah, I see. I'm pretty much a noob when it comes to Javascript/jQuery. Thank you!

@lukeshumard
Copy link
Contributor

what paul said. the infinite-scroll plugin uses jquery's .load method, which doesn't load scripts, just html. if you want to reinitialize the youtube script each time, you'll need to load that in through a different ajax request in the callback function of infinite scroll.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants