在来自scripterlative的示例代码中,您可以将滚动区域调整为仅来自边缘。该示例设置为20%边界:
new CursorDivScroll('userComment', 20, 10);
您可以更改第二个参数为50,看看是否有帮助。
至于原来的网站,你需要整理的JavaScript来看看它是如何工作的。页面内容通过AJAX加载。搜索函数runTransition(page)。在介绍之后,这会拉入“主页”页面。此内容包含JavaScript的一个更为有用位:http://www.fromtheroughmovie.com/js/main-home.js
从那里,你可以看到演员如何将图像滚动:
<div id="home-mosaic">
<ul>
<li id="cast-image1">...</li>
<ul>
</div>
,做的辛勤工作的JavaScript似乎是一个jQuery的动画:
$("#home-mosaic > ul > li").mouseenter(function() {
$(this).find("div.home-mosaic-separation").animate({'width': (currentWidth*0.20) + 'px', 'left': (currentWidth*0.40) + 'px'}, 400);
});
$("#home-mosaic > ul > li").mouseleave(function() {
$(this).find("div.home-mosaic-separation").css({'width': (currentWidth*0.02) + 'px', 'left': (currentWidth*0.49) + 'px'});
});
希望有帮助!
是的,我看着它,并尝试,但事实是,我似乎无法将它与鼠标的位置和运动(数学等这么糟糕...)。 – Tychoblood 2012-02-01 11:54:43