Hi
Look at this:
// --SCROLL TO ELEMENT--
jQuery(document).on("click", ".scroll-to-content", function(event) {
event.preventDefault();
var target = "#" + this.getAttribute("data-target");
jQuery("html, body").animate(
{
scrollTop: jQuery(target).offset().top
}, 750);
});
// --SCROLL TO ELEMENT END--
Elements with the class "scroll-to-content" have a data attribute called "data-target".
The value of "data-target" becomes the element it scrolls to.
Example:
<p class="scroll-to-content" data-target="my-funky-div">My paragraph text</p>
<div id="my-funky-div"> some cool div stuff </div>
See how that goes, I might have made a mistake in posting the code ;)
Bucklash