[Resolved] Script is working only in Customize mode

Home Forums Support Script is working only in Customize mode

This topic contains 4 replies, has 2 voices, and was last updated by  David 2 months, 1 week ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #869881

    Karel

    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 πŸ™‚

    GeneratePress 2.2.2
    GP Premium 1.7.8
    #869898

    David Customer Support

    Hi there,

    try replacing the $ with jQuery

    #870049

    Karel

    Great that did the job.

    Thank you very much David πŸ™‚

    #870050

    Karel

    Great that did the job.

    Thank you very much David πŸ™‚

    #870170

    David Customer Support
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.