tags:

views:

44

answers:

2

I have a click handler, which has "event.preventDefault". There is whole lot of logic that occurs within this function. At the end of this logic i would like the page to scroll up to the top. ie the same effect as an anchor. ie "

    $('.vod-playlist-film a').bind("click", function(event) {

    // some logic
    // now i need the browser to goto the top of the page

    event.preventDefault();
});
+1  A: 

Hi,

$(document.body).scrollTop(0);

should do the work.

kind Regards,

--Andy

jAndy
Safari and maybe Chrome seem to get nervous about using the body like that, so it may be necessary to wrap the page in a dummy `<div>` (or one of those trendy new HTML5 elements).
Pointy
A: 

You can use scrollTop method.

Giorgi
frosty