Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1002490
    Rue Nel
    Moderator

    Hello There,

    I went ahead and edited the JS code. The final code is this:

    jQuery(document).ready(function($) {
      var $adminbarHeight       = $('#wpadminbar').outerHeight();
      var $navbarFixedTopHeight = $('.x-navbar-fixed-top-active .x-navbar').outerHeight();
      var locHref               = location.href;
      var locHashIndex          = locHref.indexOf('#');
      var locHash               = locHref.substr(locHashIndex);
    
      if(locHash.length > 0){  
    
        console.log('hashed:' + scrollToPosition);
        console.log($(locHash).offset().top);
      	$('html,body').animate({scrollTop: $(locHash ).offset().top - ($navbarFixedTopHeight +1) }, 700, function(){
          window.location.hash = "" +locHash;
          // This hash change will jump the page to the top of the div with the same id
          // so we need to force the page to back to the end of the animation
          $('html,body').animate({ 'scrollTop': $(locHash ).offset().top - ($navbarFixedTopHeight +1) }, 0);
    	   });
       }
    });

    Hope this would work out for you.

    #1004069
    logoglo
    Participant

    Finally! thanks, its working perfectly! thanks for putting the time into this guys.

    #1004071
    Rupok
    Member

    You are welcome!

    Glad that it helped. Feel free to let us know if you face any other issue. We’ll be happy to assist you.

    Thanks for using X.

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-866551 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>