开发者

Scrolling up when resizing colorbox

First, sorry if I don't use correct words, but my english is not the best, and my problem is kind of complicated to explain, for me.

So, I am using Colorbox from JQuery, and I display a开发者_开发技巧 long content in the colorbox, so there is a scrollbar on the windows (but not the colorbox). But I dynamically add content to the colorbox, so I have to resize the colorbox. The problem is that when I resize the colorbox, the all window is scrolling up to the top of the colorbox, and I would just like the content to be added, but the position of the user shouldn't change.

So is it possible the resize a colorbox without beeing bring back to the top of the page ? (If you don't understand anything I said, tell me, and I will try my best to make me understanable)

Thanks !!


Assuming the new content is getting added at the end of the div, I think you could just capture the scroll position before content is added:

var scrollposition = $("#yourcontentdiv").scrollTop();

// add content here

$("#yourcontentdiv").scrollTop(scrollposition);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜