scottcorgan / angular-scrollto

Angular directive to scroll to element by selector.
MIT License
54 stars 10 forks source link

Set the default container to 'html, body', and fixed the issues with con... #3

Closed Maidomax closed 10 years ago

Maidomax commented 10 years ago

...secutive clicks

As discussed in issue #2

scottcorgan commented 10 years ago

What were the consecutive clicks?

Maidomax commented 10 years ago

For instance if I have links on the right side of the screen, and they stay on the screen at all times (with "position: fixed"), and the rest of the page scrolls, and I have an element 600px down the page, if I have a link <a href="" scroll-to="#element">Go to element</a>, and I click it, the page will scroll down 0 + 600 - 0 pixels from the top, which is what I want. If I click it again, it will scroll down to 600 + 600 - 0 pixels from the top, which I don't want. If I click i t again, it will scroll down 1200 + 600 + 0 pixels. The current scroll offset shouldn't be factored in, as it doesn't matter. You just want to scroll down to the position of the element, minus the custom offset if provided through the attribute on the link element.

scottcorgan commented 10 years ago

Thanks for the patch! Published and tagged.