Home jquery How to make a smooth scrolling on jQuery on the Joomla website

How to make a smooth scrolling on jQuery on the Joomla website




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.

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;


& 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.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions