One Page scroll to nav

Can anyone suggest a good scroll-to navigation js-plugin that work well with roots? I’ve tried a couple and the just not playing ball. It’s for a one page site and it would be great to get it integrated.

What plugins have you tried that don’t work?

Here’s a simple one I put together that’s really lightweight.

The way I’ve got it set up it only looks for links in the .navbar

$(function() {
  $('.navbar a').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
      var target = $(this.hash);
      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
      if (target.length) {
          scrollTop: target.offset().top -200
        }, 500);
        return false;

Cheers wynnepiriini that worked great!! I owe you a beer :smile:

1 Like

I would still like to know which plugins you tried that didn’t work to make sure Roots isn’t the culprit with any plugin conflicts.

Hi Ben, I used and but it might be that I have conflict with the slider I was using

Final site