Im using this script (following a video tutorial) but nothing happens and I have no error:
$(document).ready(function () {
var scrollTop = $(window).scrollTop();
var windowSize = $(window).height();
var appart = 50;
display(scrollTop, windowSize);
$(window).resize(function(){
var windowSize = $(window).height();
});
$(window).scroll(function(){
var scrollTop = $(window).scrollTop();
display(scrollTop, windowSize);
});
function display(scrollTop, windowSize){
$('.wp-post-image').each(function(){
var elemTop = $(this).offset().top;
if($(this).css('opacity') === 0 && (parseInt(elemTop) <= parseInt(scrollTop + windowSize - appart))){
$(this).fadeTo(2000,1);
}
});
}
});
Its supposed to display my content with transition when scrolling on the page (like lazy loading).
Im using wordpress.
I really don’t understand why it does not work.
Thank you.
Taken from this page of the WordPress Codex:
Hope that helps.