Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with #anchor links #275

Open
NoLooseEnds opened this issue Feb 23, 2017 · 2 comments
Open

Problem with #anchor links #275

NoLooseEnds opened this issue Feb 23, 2017 · 2 comments

Comments

@NoLooseEnds
Copy link

NoLooseEnds commented Feb 23, 2017

Hi, a couple of problems with anchor links.

By using JS provided in the advanced help section

$( 'a[href^="#"]' ).on( 'click', function( event ) {
  event.preventDefault();

  var target = $( this ).attr( 'href' );

  $( '[canvas="container"]' ).animate( {
    scrollTop: target.offset().top,
  }, 1000 );
} ); 
  • It jumps to the anchor point, but no smooth scrolling.
  • Other anchor links not in the Slidebars don't work.
  • I got an compiling error on "target.offset().top;". Changing it to "," or nothing let's it compile.

Any help around this issue?

@NoLooseEnds NoLooseEnds changed the title Problem with #anchorlinks Problem with #anchor links Feb 23, 2017
@cernyjakub
Copy link

I think the

scrollTop: target.offset().top line should be scrollTop: $(target).offset().top

That should help you.

@NoLooseEnds
Copy link
Author

NoLooseEnds commented Feb 23, 2017

Thanks, but it did not change any behaviour. It still jumps to the anchor, no smooth scroll.

(and not the other normal – non slidebar – anchor links does not work at all – I guess that is the biggest issue.)

EDIT:
It actually did change the behaviour on non-sidebar anchor links. They work with smooth scrolling.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants