简体   繁体   English

带有滚动和拖动的jQuery页面导航器

[英]jquery page navigator with scroll and drag

i create a page navigator with jquery. 我用jQuery创建一个页面导航器。 is a thumbnail of the page with a box of aspect ratio (1/10) 是带有宽高比(1/10)框的页面的缩略图

DEMO 演示

I can drag the box #screen and animate the window scroll, and I can scroll the window and update the box position. 我可以拖动框#screen并为窗口滚动设置动画,然后可以滚动窗口并更新框位置。

my problem is the use of both actions..when I drag the box.. the scroll go crazy! 我的问题是同时使用两个动作。当我拖动盒子时,滚动变得疯狂! thanks 谢谢

The scrolling also ocurs on the #screen frame because of it's absolute position. 由于其绝对位置,因此在#屏幕框架上也会发生滚动。 If you fix it, it will work better: 如果您修复它,它将更好地工作:

#screen {
    border:1px solid red;
    position:fixed;
    cursor:pointer;
}

Also the animation seems to be not such a good idear. 同样,动画似乎也不是一个好主意。 If you change it to normal scrolling it nearly works. 如果将其更改为普通滚动,则几乎可以使用。

$('html').scrollTop(currentPos.top).scrollLeft(currentPos.left);

The rest is fine-tuning and playing around with the margin. 其余的都进行了微调,并在边际上发挥作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM