Ok so I have a code what it does is scroll the page to a div (depending on its ID) when an <a> link is clicked
I want to change it so when a DIV is clicked it'll scroll to the related div
heres the code:
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
<a href="#one">Click</a>
<div id="one"></div>
So when <a> is clicked it scrolls to the div with the ID of "one" (href="#one")
I want to reproduce this by altering the code so instead of an <a> link that is clicked a div is clicked instead that scrolls to the div with id of "one"
then i want to put the code into edge ^_^
Any ideas on how to alter it ?
Thanks in advance!