उम्मीद है कि इस समाधान उपयोगी है आप ... यह वर्ग के नाम के साथ 'सभी तत्वों पर काम करेंगे के लिए scroll- धावन पथ'। '{:, "0" "y": "x" "0"}' डेटा-स्क्रॉल =: तुम भी स्क्रॉल तत्व नामक नई विशेषता प्रदान करनी चाहिए आप इसे यहाँ का परीक्षण कर सकते हैं: http://jsfiddle.net/CgZDD/
-जेएस-
$(document).ready(function(){
// make sure overflow is set to 'scroll'
$('.scroll-track').css({
overflow: 'scroll'
});
$('.scroll-track').scroll(function() {
var scrollData = $(this).data('scroll');
if(scrollData.y > $(this).scrollTop()){
$('#scrollDir').append($(this).attr('id') + ' up');
}else if(scrollData.y != $(this).scrollTop()){
$('#scrollDir').append($(this).attr('id') + ' down');
}
if(scrollData.x > $(this).scrollLeft()){
$('#scrollDir').append($(this).attr('id') + ' left');
}else if(scrollData.x != $(this).scrollLeft()){
$('#scrollDir').append($(this).attr('id') + ' right');
}
$('#scrollDir').append('<br />');
scrollData.x = $(this).scrollLeft();
scrollData.y = $(this).scrollTop();
$(this).data('scroll', scrollData);
});
});
स्रोत
2010-11-29 21:49:19