Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1374286

    Dear Mike,
    Good day.

    Refer to the previous ticket https://kriesi.at/support/topic/hide-top-menu-and-logo-when-the-scroll-reach-on-particular-section/#post-1357884 the suggested script was working fine for long. Hence, I believe from the last theme update the script was not working could you check what is the issue.

    waypoint-trigger
    e.g. link https://www.qhsedirectory.com/portfolio-item/hse-career-directory/
    The logo, main menu, header has to be hidden when the waypoint-trigger executes.

    Kindly check and let us know.

    Thank you & BR
    Anish Appukuttan
    Dubai.

    #1374388

    Hey qhsedirectory,
    It looks like the ending bit of code is missing from the script, but I can’t tell for sure without logging in, and I think your caching plugin is delaying the loading of jQuery so the script won’t work. Please disable any javascript cache settings and include a admin login so I can check the script.

    Best regards,
    Mike

    #1374429

    maybe you try it this way:

    function hide_header_main() {
    ?>
    <script>
    (function($) {
        var element_to_animate = $('.waypoint-trigger');  
        var $header = $('#header_main');
    
      element_to_animate.waypoint(function(direction) {
        if (direction === 'down') {
          $header.addClass('waypoint-hide');
        }
       },{offset: '10%'}
      ); 
    
      element_to_animate.waypoint(function(direction) {
        if (direction === 'up') {
          $header.toggleClass('waypoint-hide');
        }
       },{offset: '10%'}
      );
    })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'hide_header_main', 9999);
    #1374430

    or – if it necessary to wait till DOM is loaded:

    function hide_header_main() {
    ?>
    <script>
    window.addEventListener('DOMContentLoaded', function() {
      (function($) {
          var element_to_animate = $('.waypoint-trigger');  
          var $header = $('#header_main');
    
        element_to_animate.waypoint(function(direction) {
          if (direction === 'down') {
            $header.addClass('waypoint-hide');
          }
         },{offset: '10%'}
        ); 
    
        element_to_animate.waypoint(function(direction) {
          if (direction === 'up') {
            $header.toggleClass('waypoint-hide');
          }
         },{offset: '10%'}
        );
      })(jQuery);
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'hide_header_main', 9999);

    or try your script and look if the semicolons are needed

    #1374518
    This reply has been marked as private.
    #1374643

    Hi,
    Thanks for the login, I see that if I inject jQuery.js and waypoint.js the script works, but both of these should be loaded automatically.
    I see that all of your js is loaded by “rocket-loader” but I don’t see this plugin, I see that your LScache can not be controlled from WordPress and you have to do so from your server:
    2022-12-01_005.jpeg
    Please try to disable the “rocket-loader” and check again.

    Best regards,
    Mike

    #1374941

    Hello Mike,
    Good day.

    Thank you so much for the suggestion. I found that, the rocket-loader is actually running from CloudFlare, So I have disabled the option from the Cloudflare configuration settings. Now, it is working perfectly.

    Thank you so much once again.
    BR
    Anish Appukuttan
    Dubai.

    #1374944

    Hi,
    Glad to hear that you have this sorted out, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘WayPoint Trigger’ is closed to new replies.