How do i scroll to a pa开发者_运维问答nel within an updatepanel after i load the content
You could use the jQuery ScrollTo plugin to achieve this.
$.scrollTo($('#myPanel'));
Here's a direct link to the plugin demo page.
You could use the jQuery ScrollTo plugin to achieve this.
Usually we scroll the page to somewhere by appending its name to the url. Here is an example:
//test.aspx
<div id="myDiv" name="theDIV">
I'm in the bottom of the page
</div>
At the beginning you visit this page you will see a normal page. But instead in you visit test.aspx#theDIV
the browser will scroll to the bottom of the page(scroll to the div).
This is what I ended up doing
$("#divGetListforUser .btn").click(function() {
isClicked = true;
});
function scrollTo() {
if (isClicked) {
$.scrollTo($("#main .header"), { duration: 1000 });
isClicked = false;
}
}
and form codebehind:
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "scrollToKey", "scrollTo()", true);
精彩评论