I have a div set up as a link. On click, it travels to an anchor within the page. Used this method to make an entire div a link: Make Div a Link
The problem is not the function of the link itself, but that I can't get it to smooth scroll to the anchor. Smooth scrolling was working prior to setting the div as the link (when it was just a text link).
Can't get the two scripts to play nicely.
$(document).ready(function() {
$('a').click(function(){
$('html, body').animate({
scrollTop: $( $.attr(this, 'href') ).offset().top
}, 500);
return false;
});
$("div#learnMore").click(function() {
window.location = $(this).find("a").attr("href");
return false;
});
});
Set up a JSFiddle here with the full code: http://jsfiddle.net/HNbdm
Any insight would be greatly appreciated!