I know that you can jump to elements by id but is it possible to jump to elements by class?
Am I going to have to use javascript to add an id to the element with that class name?
It would be a pain to add ids manually every time, the class names will already be there.
*I could have worded my question a bit better. I meant to use class names that are already there as anchor tags to jump to. The html I'm working with has class names for a LOT of individual elements and no ids. I'm wanting to jump to those elements without having to add an id to each and every one.
window.scrollTo(0, document.querySelector(".className").offsetTop);
http://jsfiddle.net/DerekL/kEFp7/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With