javascript - Scroll to Top in iframe without reloading -


i tried scroll top of iframe without reloading. have form within iframe. when click submit button, should moved top of iframe without reloading.

i tried following codes,

top.location.href = '#top';

window.parent.location.hash = "#top";

but reloading. should not reload page. because, when loads , validation error message javascript becomes invalid.please helpful achieve one.

thanks in advance

use function window.scrollto(xpos, ypos) window.scrollto(0,0)

if want animated, can use jquery's animate function, , set scrolltop 0, this:

$('iframe').animate({     scrolltop: 0 }); 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -