skrollr-menu icon indicating copy to clipboard operation
skrollr-menu copied to clipboard

Webpage doesn't scroll as in demo when click on navigation links

Open sfregolina opened this issue 9 years ago • 2 comments

Hello,

I'm using this useful plugin - combined to skrollr.js plugin - on my website.

When I click on the navigation link, the section changes but I there's no the scrolling animation as seen in the demo.

This is the website. http://www.rene-official.com/rene.html

How can I fix it?

Thank you

sfregolina avatar Nov 03 '15 17:11 sfregolina

Hi there,

Thank you for this.

I'm a bit confused as I'm not sure where I should add this code. Also, I don't really know what the example's selector stand for and I find it difficult to change them with my own selectors.

Can you give me an extra help with this please? It would be much appreciated.

Thanks! Federica

2015-11-03 19:52 GMT+01:00 Dan Boggins [email protected]:

sfregolina you can use "moveTo" to move to the elements ID, that's how I've done it for a site, code is as such (obviously you'll need to update your selectors accordingly):

$('nav a').click(function(e){ e.preventDefault(); // I use data-index here, you could use the ID of the element // you want to move to but you might need to prepend a '#' var ind = $(el).attr('data-index'); $('#wraptest').moveTo(ind); }); // then I use this to add a class to the active navigation element $('#onepage_scroll_wrap').onepage_scroll({ // you could use afterMove if you prefer beforeMove: function(index){ var el_id = $('.page_section.active').attr('id'); $('nav a').removeClass('active'); $('nav a[data-href="#' + el_id + '"]').addClass('active'); } });

— Reply to this email directly or view it on GitHub https://github.com/Prinzhorn/skrollr-menu/issues/83#issuecomment-153452611 .

Federica Sfregola Digital & Web Designer +44 7447 720257 +39 338 1683844

sfregolina avatar Nov 06 '15 12:11 sfregolina

Hi Frederica

My apologies I had actually deleted my comment after realising I was talking about a different plugin. I used this plugin: https://github.com/peachananr/onepage-scroll and the code I posted works with that and does what you want, however perhaps someone else might be able to help you with regards to skrollr-menu.

Thanks,

Dan

On 6 Nov 2015 12:04 pm, "sfregolina" [email protected] wrote:

Hi there,

Thank you for this.

I'm a bit confused as I'm not sure where I should add this code. Also, I don't really know what the example's selector stand for and I find it difficult to change them with my own selectors.

Can you give me an extra help with this please? It would be much appreciated.

Thanks! Federica

2015-11-03 19:52 GMT+01:00 Dan Boggins [email protected]:

sfregolina you can use "moveTo" to move to the elements ID, that's how I've done it for a site, code is as such (obviously you'll need to update your selectors accordingly):

$('nav a').click(function(e){ e.preventDefault(); // I use data-index here, you could use the ID of the element // you want to move to but you might need to prepend a '#' var ind = $(el).attr('data-index'); $('#wraptest').moveTo(ind); }); // then I use this to add a class to the active navigation element $('#onepage_scroll_wrap').onepage_scroll({ // you could use afterMove if you prefer beforeMove: function(index){ var el_id = $('.page_section.active').attr('id'); $('nav a').removeClass('active'); $('nav a[data-href="#' + el_id + '"]').addClass('active'); } });

— Reply to this email directly or view it on GitHub < https://github.com/Prinzhorn/skrollr-menu/issues/83#issuecomment-153452611

.

Federica Sfregola Digital & Web Designer +44 7447 720257 +39 338 1683844

— Reply to this email directly or view it on GitHub https://github.com/Prinzhorn/skrollr-menu/issues/83#issuecomment-154393828 .

danboggins avatar Nov 06 '15 14:11 danboggins