[英]maintaining scroll bar position using javascript/jquery (jqgrid)
I have a problem with regards to maintaining the scroll position
of my jqgrid
. 我在保持
jqgrid
的scroll position
方面有问题。
Here is the objective of my program: 这是我程序的目标:
I have no problem with these steps (1-5) 这些步骤没有问题(1-5)
My problem is that if I have extensive rows for example 500 rows. 我的问题是,如果我有大量的行,例如500行。 It will display the scroll bars on the side of the jgrid.
它将在jgrid的侧面显示滚动条。
What I want to do is to maintain the scroll position of the scroll bars using Javascript or jQuery. 我想做的是使用Javascript或jQuery维护滚动条的滚动位置。 How do I do this?
我该怎么做呢?
I tried to use this, on loadcomplete event 我试图在loadcomplete事件上使用它
var scrollPosition = 0;
scrollPosition = jQuery("#jqgrid").closest(".ui-jqgrid-bdiv").scrollTop(scrollPosition);
jQuery("#jqgrid").closest(".ui-jqgrid-bdiv").scrollTop(scrollPosition);
but it doest give me the value of the scroll position 但是它没有给我滚动位置的值
See . 请参阅。 this fidle based on this article
该文章基于本文
<input type="submit" id="button"/>
<div id="div1"> </div>
$("#button").click(function() {
$('html, body').animate({
scrollTop: $("#div1").offset().top
}, 2000);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.