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

    Dear Support,

    Good day.
    I would like to remove/ hide header menu and logo when the scroll down reach particular section of the window.
    This changes I need only for certain pages, i.e. I have installed Table press plugin, when we scroll down to reach the window on the Tablepress Tables, the header menu bar and logo should disappear. and when scroll up it should appear/ show the menu and the logo.

    Please advice.

    Thank you in advance.
    BR
    Anish Appukuttan

    #1357877

    Hey qhsedirectory,
    Thanks for the link to your page, currently you have an error showing at the top of your page above your menu:

    /** Add your own functions here. You can also copy some of the theme functions into this file. * WordPress will use those functions instead of the original functions then.*/
    

    this is the text in your child theme functions.php, please try removing any changes that you have made to correct.

    As for hiding and showing the header when a specific place on the page is in view, I tested on an example page containing many columns with text blocks, and for one text block I added a custom class waypoint-trigger:
    2022-07-10_004.jpg
    this “trigger” element is down a ways on the page so it is not in view on the page load:
    2022-07-10_005.jpg
    then I added this css in the Enfold Theme Options ▸ General Styling ▸ Quick CSS field:

    .waypoint-hide {
      position: fixed !important;
      top: -100px;
      width: 100%;
      z-index: 999;
      opacity: 0;
      background: #fff;
      transition: 0.3s all;
      box-shadow: 0 2px 3px rgba(0,0,0,0.15);
    }
    
    .waypoint-show {
      top: 0;
      opacity: 1;
      transition: 0.3s all;
    }

    and this code in the child theme functions.php file in WordPress ▸ Appearance ▸ Editor:

    function custom_waypoint_trigger_script() { ?>
      <script>
    window.addEventListener('DOMContentLoaded', function() {
    (function($){
      var $header = $('#header_main');
      var $things = $('.waypoint-trigger');
      $things.waypoint(function(direction) {
        if (direction === 'down') {
           $header.addClass('waypoint-hide');
           $header.removeClass('waypoint-show');
        }
        if (direction === 'up') {
           $header.addClass('waypoint-show');
           $header.removeClass('waypoint-hide');
        }
      }, {
        offset: '95%'
      });
    })(jQuery);
    });
    </script>
      <?php
    }
    add_action('wp_footer', 'custom_waypoint_trigger_script');

    Note in the script the “offset” is 95%, this will trigger when the element is just in view, you can adjust to suit, such as 50% for when the element is in the middle of the page.
    Please give this a try, I linked to my example page below.

    Best regards,
    Mike

    #1357884
    This reply has been marked as private.
    #1357887

    Hi,
    Thank you for the login to your site I believe the issue was that your child theme functions.php was missing the top <?php
    I added it back and the script and the css to your child theme stylesheet.
    I also adjusted the offset to 10% so the header hides just before the table gets to it.
    Please clear your browser cache and check.

    Best regards,
    Mike

    #1357916

    Dear Mike,
    Good day.

    Thank you so much for the script, it is working perfect, the way I want.
    I have adjusted other settings accordingly, now the tablepress content and the heading visible on the full page.

    You can close this ticket.
    Thank you once again.

    BR
    Anish Appukuttan

    #1357924

    Hi,

    Great, I’m glad that Mike could help you out. I’ll close this thread for now then, please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Hide top menu and logo, when the scroll reach on particular section.’ is closed to new replies.