-2
我在網頁中使用http://cubiq.org/dropbox/iscroll4/examples/simple/我正在開發並希望在用戶滾動/拖動時優先執行代碼,例如,特定行中的文本應該隨用戶滾動而淡入下。不過,我覺得我可以用這樣的:在滾動元素上執行代碼
$(window).on('scroll', function() {
var st = $(this).scrollTop();
$('li.frame1 img').css({
'top' : -(st/3)+"px",
'left' : -(st/3)+"px"
});
});
但用戶實際上向下滾動元素#scroller
,而不是窗戶。我怎麼能適應這個或實現我想要做的?
謝謝!
如何定位'#scroller'而不是'window'? – tymeJV