I have a live live demo here:
What am I going to do when My JQuery looks like: HTML Sample: to resolve the error Also consider? Update: [Solution] < Code> var nn = $ (this) .attr ('id'). Replace ('a', ''); >, Because there is no "A" in the id, nothing changes Then you search for 1 box should be clicked, the first section should scroll, when the
2 box is clicked, it should scroll in the second section and even further. But when I click on the numbers, I get the following error:
Offset (). Whether the top item is zero or not
$ (function () {$ (". Pointto"). Mouseover (function $ ("$"); $ (This) .addClass ("hover"); $; ($ ("(". "), $ (" Pointto "). MouseDown (function () {$ (this) $ (". ") ; $ ("Point"). Mouse (function () {$ (this) .removeClass ("pressed");}); $ (document) .on ('click', '. (', ''); By clicking on '1' [name = "'",' A '+ Nn +' ']]; // 1, I would like to add a name to t = $ (' a [ Name = '' + nn + '"]' '). Offset (). Top; // t = $ (' a [name = '' + nn + ''] '). Offset (). Top; $ ( 'Body, html'). Chetan ({scrollTop: t}, 800);});});
& lt; an id = "s01" square = "dot" and gt; 1 & lt; / a & gt; // clickable link ... .. ... ... about a name = "01" & gt; 1 & lt; / a & gt; // target
$ (document) .on (pressed 'click', 'again. Gone, .pointto ', function () {var nn = $ (this) .attr (' id '). ('S', ';); Warning ('a [name =' + + nn + ']'); T = $ ('a [name =' '+ nn +' ']'). Offset (). Top; // t = $ ('A [name = "' + nn + '"]'). Offset (). Top; $ ('Body, html') Chetan ({scrollTop: t}, 800);}); Depending on your post HTML, you have it:
id is
s01 ,
nn is now set to
s01
t = $ ('a [name =' '+ nn +' ']'). Offset () top;
a with the
name for
s01 . Your anchor does not have this name, your anchor name is
1 anything is offset tap, so you try to get the property of zero
top .
No comments:
Post a Comment