Custom links in header and also page anchor links no longer working

Hello,

I have several custom links in my header nav, and various anchor links through pages, and suddenly they are no longer working.

here is one page you can see: http://thealignedcenter.flywheelsites.com/about/

They were all working fine not long ago.

Can you help me trouble shoot what is happening?

We are due to launch the site on Monday!

Thanks,

Sophie

Hi,

I had themeco staff add the following custom code to add spacing to the anchor links due to the sticky header, and that seems to be what is causing the issue.

Can you tell me what needs editing so that the spacing still exists and the anchor links work again?

Thanks

jQuery(document).ready(function($) {

var $body = $(‘body’);
var bodyHeight = $body.outerHeight();
var adminbarHeight = $(’#wpadminbar’).outerHeight();
var navbarFixedTopHeight = 58;
var locHref = location.href;
var locHashIndex = locHref.indexOf(’#’);
var locHash = locHref.substr(locHashIndex);
var dragging = false;

$body.on(‘touchmove’, function() {
dragging = true;
} );

$body.on(‘touchstart’, function() {
dragging = false;
} );

//
// Calculate the offset height for various elements and remove it from
// the element’s top offset so that fixed elements don’t cover it up.
//

function animateOffset( element, ms, easing ) {
$(‘html, body’).animate({
scrollTop: $(element).offset().top - adminbarHeight - navbarFixedTopHeight + 1
}, ms, easing);
}

//
// Page load offset (if necessary).
//

$(window).load(function() {
if ( locHashIndex !== -1 && $(locHash).length ) {
animateOffset(locHash, 1, ‘linear’);
}
});

//
// Scroll trigger.
//

$(‘a[href*="#"]’).unbind(‘touchend click’).bind(‘touchend click’, function(e) {
console.log($(’.hm1.x-bar-fixed’).outerHeight());
href = $(this).attr(‘href’);
notComments = href.indexOf(’#comments’) === -1;
if ( href !== ‘#’ && notComments ) {
var theId = href.split(’#’).pop();
var $el = $(’#’ + theId);
if ( $el.length > 0 ) {
e.preventDefault();

    if (dragging) {
        return;
    }
    
    animateOffset($el, 850, 'easeInOutExpo');
  }
}

});
});

setInterval( function() {
jQuery( ‘.current-menu-item a’ ).each( function() {

jQuery(this).addClass(‘x-interactive’);
jQuery(this).parent().find(‘a > span > span’).addClass(‘x-active’);

} ); }, 300);

Hello @SophiePeirce,

Thanks for writing in! :slight_smile:

It seems the anchor links are working fine. I’ve tested the About Us page and also the other pages.

Maybe your cache was cleared by someone? Not sure. Can you confirm if the page is working on your end?

If you still have the same problem, kindly update your WP Pass on the secure note as it isn’t working.

Thank you.

Hi there - everything worked when i removed the custom code i pasted above - which was to add some spacing to the top of all my anchor links…

at the moment i have added in as much padding above my anchor links in the page as i care too, to make them so they just make it on the page when clicking to from an anchor link…

I would like to use the code as it gave more space, - but it was causing all the links not to work…

Is that clearer?

Thanks

Hi There,

One page navigation is not yet fully supported with Pro. It is different from the One page navigation with X theme. The entire functionality of one page navigation in Pro header builder with the correct scroll is still under development (https://theme.co/apex/forum/t/bug-fixing-usability-update/26811).

As of the moment, it needs custom JS code to achieve the correct scroll position, which is outside the scope of our support. On other cases we do our best to provide sample codes but on this situation it might result in complication further down the line.

What I could advise for now is to bring back the default top margin of your section headlines.

We’re sorry for the inconvenience and we will let you know once we have an update.
Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.