Snap.js icon indicating copy to clipboard operation
Snap.js copied to clipboard

Snap.js and scrollit (or anchor smooth scrolling)

Open sineus opened this issue 10 years ago • 4 comments

Great job for this plugin! But I can not seem to scroll the page with anchors. this does not work either with the plugin scrollit I do not understand ... Here is my code: $ (function () {    $ ("a [href * = '#']"). click (function () { $ ('# content'). animate ({ scrollTop: $ ($ attr (this, 'href').) offset () top.. }, 1000); return false; }); });

I have put # content instead of body, html but nothing works Thank you in advance!

sineus avatar Jul 09 '14 19:07 sineus

Could you set up a testcase using http://jsfiddle.net or similar?

frankie-loves-jesus avatar Jul 09 '14 20:07 frankie-loves-jesus

check => david.gaspardmacelin.com/portfolio thanks !

sineus avatar Jul 10 '14 11:07 sineus

Reduced test case required

All bug reports and problem issues require a reduced test case. See http://css-tricks.com/reduced-test-cases/ on why they "are the absolute, ... number one way to troubleshoot bugs."

  • A reduced test case is an isolated example that demonstrates the bug or issue.
  • It contains the bare minimum HTML, CSS, and JavaScript required to demonstrate the bug. No extra functionality or styling.
  • A link to your site is not a reduced test case.

frankie-loves-jesus avatar Jul 10 '14 13:07 frankie-loves-jesus

Hi, I am having the same issue. After lot of debugging, i found that the position:absolute for the following css style is causing default scrollTop to fail.

snap-drawer, [snap:drawer], [snap-drawer], [data-snap-drawer], [x-snap-drawer], .snap-drawer, .x-snap-drawer, .snap-drawer{ position: absolute; }

If we comment out this part, scrollTop works perfectly.

roymj88 avatar Jul 21 '14 12:07 roymj88