Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

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

Open
sfregolina opened this issue Nov 3, 2015 · 2 comments
Open

Comments

@sfregolina
Copy link

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
Copy link
Author

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
#83 (comment)
.

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

@danboggins
Copy link

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
<
#83 (comment)

.

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


Reply to this email directly or view it on GitHub
#83 (comment)
.

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

No branches or pull requests

2 participants