Hello!
There is a website: Link Text
It is necessary to implement a smooth scrolling by the anchors. The menu is done using the usual HTML code module. Each menu item is spelled out links to Jacri in the article.
I use the following code for smooth scroll:
$ (document) .ready (function () {
$ ("a.toplink"). Click (Function () {
$ ("HTML, BODY"). Animate ({
Scrolltop: $ ($ (this) .attr ("href")). offset (). TOP + "PX"
}, {
Duration: 500.
});
RETURN FALSE;
});
});
But for some reason it does not work, although the library has connected to the template. Please tell me how to do it right? For the first time I come across this just
Thank you all for the answers, everything turned out.
Answer 1, Authority 100%
The script does not work, as the page has no items with the items, which is registered in the reference target. Accordingly, $ ($ (this) .attr ("href"))
returns 0 elements. On the page all the Yakori on which you refer to change C:
& lt; a name = "[name]" id = "vector" & gt; & amp; nbsp; & lt; / A & GT;
on
& lt; a id = "[Name]" & gt; & amp; nbsp; & lt; / a & gt;
Small demonstration: http://jsfiddle.net/hack9/1/
PS: In fact, you have now on the page mass of elements with the same ID “Vector”, which is pretty bad.