Reputation: 818
I have a fade-in effect for a site which I'm loading onto Wordpress. I'm using jQuery for the effect, these effects weren't working at first but I've changed some of the code and now it works fine on Firefox and Safari but not Chrome. What I've discovered is that Chrome keeps wanting to upload the code which I've changed - so the error is still persisting.
This is the correct code -
fadein.js
jQuery(document).on("scroll", function () {
var pageTop = jQuery(document).scrollTop()
var pageBottom = pageTop + jQuery(window).height()
var tags = jQuery("section")
for (var i = 0; i < tags.length; i++) {
var tag = tags[i]
if (jQuery(tag).position().top < pageBottom) {
jQuery(tag).addClass("visible")
} else {
jQuery(tag).removeClass("visible")
}
}
})
And this is the old code -
$.noConflict();
jQuery(document).ready(function($) {
var win = $(window),
doc = $(document),
tags = $("section");
win.on("scroll", function() {
tags.each(function(i, tag) {
if ($(tag).position().top < (doc.scrollTop() + win.outerHeight())) {
$(tag).addClass("visible");
} else {
$(tag).removeClass("visible");
}
});
}
});
});
Which keeps giving me this error in the console -
But it's still loading the old code -
I've double checked the code in firefox and safari and they're loading the new code - and the effect is working fine. With Chrome the page is effectively blank because the page sections begin the process with opacity: 0;
until the scroll reveals them. Any assistance on this would be appreciated.
Upvotes: 0
Views: 522
Reputation: 31761
It can be helpful to disable the cache when DevTools is open. Here's where you find it:
Upvotes: 1