Site logo

Archived topic

Script is working only in Customize mode

4 replies · Started by Karel on April 15, 2019

Viewing posts 1–5 of 5

Hello,

I would like to ask you for help/advice.
I finally have found the script for Page-headline to fade on scroll.

The problem is that it works only in customize mode, not in live page ( it is looking like it is running properly ).
I tried to purge cache in WordPress but nothing has happened.
I don´t have any cache cleaning plugin.

The script is in element - hook - after_header

<script>
var header = $('.page-hero h1');
var range = 200;

$(window).on('scroll', function () {

var scrollTop = $(this).scrollTop(),
height = header.outerHeight(),
offset = height,
calc = 1 - (scrollTop - offset + range) / range;

header.css({ 'opacity': calc });

if (calc > '1') {
header.css({ 'opacity': 1 });
} else if ( calc < '0' ) {
header.css({ 'opacity': 0 });
}

})
</script>

Thank you very much for any reply :)

Hi there,

try replacing the $ with jQuery

Great that did the job.

Thank you very much David :)

Great that did the job.

Thank you very much David :)

Glad to be of help

This archived topic is closed to new replies.