Hello I’m using valid JS I wrote and inputted through ‘customize > custom > edit global javascript’.
The script works perfectly when viewing in the ‘customize’ window. Once I ‘publish’ and view the page outside of ‘customize’, the JS is not working at all. If i view source, the script being put in DOM, but for some reason not executing?
Here’s the script:
function parallaxFade() {
scrollPos = $(this).scrollTop();
$('.banner').css({
'background-position' : '50% ' + (-scrollPos/3)+"px"
});
$('.banner-title').css({
'margin-top': (scrollPos/3)+"px",
'opacity': 1-(scrollPos/350)
});
}
$(document).ready(function(){
if ($('.banner').length ) {
$(window).scroll(function() {
parallaxFade();
});
}
else{
return;
}
});
Here’s the page:
www.jordanandalec.com