Home Forums Art WordPress Theme Hide logo on scroll

This topic contains 5 replies, has 3 voices, and was last updated by  candela 2 months, 2 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #17940

    jascal
    Participant

    Hi!

    I have a question. When i want to hide my logo on scroll. Where should i place the javascript code? And am i correct to address it with #logo or .navi-logo?

    Thank you.

    #17941

    jascal
    Participant

    I have the answer and it works 🙂

    I added this in custom.theme.js

    jQuery(function($){
    $(window).scroll(function(){
    if($(window).scrollTop() > 0) {
    $(‘.navi-logo’).hide(); // Hide your element
    } else {
    $(‘.navi-logo’).show(); // It’s just if you want to show back the element if we’re back on top
    }
    });
    });

    • This reply was modified 3 months, 2 weeks ago by  jascal.
    • This reply was modified 3 months, 2 weeks ago by  jascal.
    #17954

    BWSM
    Keymaster

    Hi,

    Good for you.
    Thanks for sharing it. 🙂

    Regards

    #17957

    jascal
    Participant

    Excuse me the right code is:

    jQuery(function($){    
        $(window).scroll(function(){ 
            if($(window).scrollTop() > 0) {
                $('.navi-logo').hide();  // Hide your element
            } else {
                $('.navi-logo').show(); // It's just if you want to show back the element if we're back on top
            }
        }); 
    });
    
    #18142

    candela
    Participant

    Hi! 🙂

    I wanted to do the same but it doesn’t work… Did you change or add anything in the css?

    Thank you! 🙂

    #18144

    candela
    Participant

    Oh, nevermind, it works now, thank you for sharing!! <3

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Join Newsletter(FREE)

Subscribe to our newsletter to receive news & updates. We promise to not spam you, super promise!