javascript - Getting anchor's offset position -


I am trying to scroll the window in one place on my page based on the user's selection. I'm getting some strange results

  var rel = $ (this) .attr ('rel'); Var quote = rel.split ("-") [0]; Window.scrollTo (0, $ ('[name =' + citation + ']'). Offset (.) Top); Warning ($ ('[name =' + quote + ']'). Offset (.) Top);  

The final warning gives me a number that seems to be wrong and scrolling is not working. The following code executes when the user clicks on a link from within the document. I am capturing the rel attribute value of that element and (using a little string manipulation) to use it to find the position of the anchor. The name attribute of the destination element must match the rel attribute of the clicked link. See what I mean?

Thank you!

This is another easy old school to scroll to the Html element:

' Scroll element with 'code' = 'quote' var node = document.getElementById ('quote'); Node.scrollIntoView ();

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -