I have a quick jQuery question (well I’m hoping it’s quick anyway!) I’ve been combing the forums and can’t stop the code from snapping to a weird scroll position (I don’t want it to scroll at all, just stay in the same place). I have a feeling this is a simple fix, but I can’t figure it out! Could you help me out? If it takes too long or you don’t want to do it, I understand! All the jQuery, CSS and HTML code is live on Tumblr:
http://patriciahighsmith.tumblr.com/quiz
$(document).ready(function()
{
$('.msg_body:not(:first)').hide();
$("a.linkclass").click(function()
{
$('.msg_body').fadeOut("slow");
$($(this).attr("href")).fadeIn("slow");
});
});
You should stop the default event from happening (which is following the anchor). You can either do this by calling
event.preventDefault()or returning false from the event handler (the latter will also stop propagation, so use with care).or