วันศุกร์ที่ 21 พฤษภาคม พ.ศ. 2553

Reset window Position when post with JavaScript.

Easy way is with javascript

javascript:window.scrollTo(0,0);

but what if your element to reset is not whole window.

try this

gotoContentTop();

and in JavaScript function gotoContentTop() like this

function gotoContentTop()
{
document.getElementById('innerContentHolderArea').scrollTop = 0;
}

For use JQuery

$('#innerContentHolderArea').scrollTop(0);

Hope this help.

ไม่มีความคิดเห็น: