在來自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