JQuery scrollTop function goes to correct position but then jumps back to top of page
问题 I used the JQuery function scrollTop on a list of contact numbers in a click function for each letter. It scrolls to where it is supposed to but then scrolls back to the top immediately. Here is a sample of the function in the code: $('.a').click(function(){ $('html, body').animate({scrollTop:$('#A').position().top}, 'slow'); }); Here is the JSFiddle I made for it: http://jsfiddle.net/CR47/MdtSE/ 回答1: If you're adding this to an anchor tag, you normally need to add a preventDefault() or