Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1179748

    Hello, this code worked well for ipad mobile:

    /* hide logo when scroll down */
    .header-scrolled .logo, .header-scrolled .av-logo-container { 
    display: none!important;
    }

    I want to hide the logo after scrolling down. Desktop working with enfold settings. Code does not hide my logo on mobilde landscape. is there a new header id, class? I cant see and open on ipad just desktop. Desktop is hiding logo – mobile not.
    Thank you for your help.

    #1179767

    I found out: .header-scrolled is not switched to when scrolling on mobile ipad 4. Dektop is switching to .header-scrolled when scrolling down. How can I check for scrolling down in ipad?

    #1180663

    Hi,
    Sorry for the late reply, since you were trying to hide the logo on scroll, please give this function a try, it will work for all screens smaller than 1024px, I believe that is the iPad landscape width, but you can adjust to suit.
    Try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_hide_logo_script(){
      ?>
      <script>
    (function ($) { 
      $(window).scroll(function() {
        var width = $(window).width(), height = $(window).height();    
        var scroll = $(window).scrollTop();
          if (scroll >= 20 && width <= 1024) {
        $('.logo').hide();
       } else {
        $('.logo').show();
       }
      });
     })(jQuery);
     </script>
    <?php
    }
    add_action('wp_footer', 'custom_hide_logo_script');

    or if you want to add and remove the header-scrolled class, try this function:

    function custom_header_class_script(){
      ?>
      <script>
    (function ($) { 
      $(window).scroll(function() {
        var width = $(window).width(), height = $(window).height();    
        var scroll = $(window).scrollTop();
          if (scroll >= 20 && width <= 1024) {
        $('#header').addClass('header-scrolled');
       } else {
        $('#header').removeClass('header-scrolled');
       }
      });
     })(jQuery);
     </script>
    <?php
    }
    add_action('wp_footer', 'custom_header_class_script');

    Best regards,
    Mike

    #1270052

    Hello.

    I also was looking for a solution for this problem and I tried the function custom_hide_logo_script.
    On a desktop everything worked well. The logo shirked und diapeared.
    On my ipad the logo disapeared BUT a blank space remained.
    So I changed the code. I changed $(‘.logo’) to $(‘.av-logo-container’). Now it worked perfect on the ipad (no blank space).
    But on the desktop it worked no more. The logo shinked but remains there.

    Is there a way to combine this two?

    I´m not so familar with php and sorry for my bad english.

    THX

    #1270132

    Hi,

    @baucks
    please include a link to your site, and please remove your “custom_hide_logo_script” code.
    So for your iPad you would like the header to be sticky and have the logo disappear on scroll, and you would like this on the desktop version. For mobile do you want the same? If you are hiding the logo on scroll why do you want you show the header, so the burger menu is visible?
    I ask because typically the header takes a lot of space on smaller screens, you might be interested in having the header scroll away when the user scrolls down and have it show when the user starts to scroll up, if you are please see this thread.

    Best regards,
    Mike

    #1270245

    Hi Mike,
    thanks for your reply and for the link.
    The code from Guenni007 is very cool.

    #1270315

    Hey baucks,

    I’m glad his suggestion was helpful for you!

    Best regards,
    Jordan Shannon

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