This is a re-post,
I'm using Masonry plugin with infinite-scroll plugin on WordPress blog. I need to use PrettyPhoto Plugin on this blog. PrettyPhoto lightbox working fine, but when Masonry loads the next set of posts (infinite scroll plugin loads the next set of post when scroll down), PrettyPhoto stops working.
I'm not a expert in jQuery so, here's the two scripts which use on the theme
https://dl.dropbox.com/u/89122367/plugins.js
https://dl.dropbox.com/u/89122367/scripts.js
I need to use PrettyPhoto on this theme, Need some help from experts
The reason why it's not working is that Prettyphoto
don't know that there are some new images to "take care of" :) . When new items are uploaded, they dont't have Prettyphoto
bind
. I think, that the easiest way is to add detection of ajax request and then fire Prettyphoto
on new images.
$(document).ajaxComplete(function() {
$("a[rel^='prettyPhoto']").prettyPhoto(); // or any other way You use prettyPhoto
});
Put the abowe code to the head section of Your page, ie:
<script>
$(document).ajaxComplete(function() {
$("a[rel^='prettyPhoto']").prettyPhoto(); // or any other way You use prettyPhoto
});
</script>
This Should help You
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.