[Resolved] Script is working only in Customize mode

Home Forums Support [Resolved] Script is working only in Customize mode

Home Forums Support Script is working only in Customize mode

  • This topic has 4 replies, 2 voices, and was last updated 5 years ago by David.
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 🙂

    #869898
    David
    Staff
    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
    Staff
    Customer Support

    Glad to be of help

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.