Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. Bug Reports
  3. Scripts with scroll functions have stopped working on several sites

Scripts with scroll functions have stopped working on several sites

Scheduled Pinned Locked Moved Bug Reports
3 Posts 3 Posters 310 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    J
    jorgenbry
    wrote on last edited by
    #1

    Hi. On two of my Lay theme sites, javascript scroll functions that worked when making the sites suddenly have suddenly stopped working. All of these three code snippets have stopped working. Do you have any idea why, and how to make them work again? All code is added with the Custom CSS and HTML settings.

    1 – On jimmylinus.com, the following code made the the About-link in second-menu offset above the footer when scrolling down.

    <script>
    $(window).scroll(() => {
        const footerToTop = $('#footer-region').position().top;
        const scrollTop = $(document).scrollTop() + $(window).height();
        const difference = scrollTop - footerToTop;
        const bottomValue = scrollTop > footerToTop ? difference : 0;
        $('nav.second_menu').css('bottom', bottomValue+25);
    });
    </script>
    

    2 – On the same site, the next and previous project arrows (as text) gradually increased in opacity when scrolling down. Now they are only visible on hover. This is the code:

    <script>
             $(document).ready(function(){ 
                $(window).scroll(function(){ 
                    $('.project-arrow').css("opacity", 0+ $(window).scrollTop() / $(document).height() ) 
                }) 
            }) 
    </script>
    

    3 – And on another site, colin.no, thumbnails for previous and next projects appeared after scrolling 90% of the height. This is the code:

    <script>
    
    $(document).scroll(function() {
      var scrollPercent = 100 * $(window).scrollTop() / ($(document).height() - $(window).height());
      if (scrollPercent > 90) {
        $('.project-arrow').fadeIn();
      } else {
        $('.project-arrow').fadeOut();
      }
    });
    
    </script>
    

    Please let me know how to fix these!

    1 Reply Last reply
    0
    • RichardR
      RichardR
      Richard
      Global Moderator
      wrote on last edited by
      #2

      Dear @jorgenbry

      Thank you for your patience
      I will forward this so that we can take a closer look

      Best wishes
      Richard

      1 Reply Last reply
      0
      • arminunruhA
        arminunruhA
        arminunruh
        Global Moderator
        wrote on last edited by
        #3

        hey please use 'jQuery' instead of '$' (without the '')

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        Online Users
        M
        michael_vvc
        C
        craigfeldspar
        Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
        laytheme.com
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Recent
        • Tags
        • Popular
        • Users
        • Search