I have 4 DIVthat I want to have an event scrollwhen you scroll through one of these divs. This is the code below.
$('#div1, #div2, #div3, #div4').scroll(function() {
alert('...');
});
In Firefox / Chrome, this is fast; however, in Internet Explorer, it works so slowly that it actually does not allow me to scroll through the div.
I am using the latest version of jQuery (v.1.4.1).
Question : Is there a more efficient way to run the code above? If so, how?
UPDATE . Since it was set, I included below all my code:
$('#div1, #div2, #div3, #div4').scroll(function() {
var scrollElemPos = activeHomeDiv.offset();
var newHighlightDiv = $(document.elementFromPoint(
scrollElemPos.left + activeHomeDiv.width() / 2,
scrollElemPos.top + activeHomeDiv.height() / 2)
).closest('.hlisting');
if(newHighlightDiv.is(".HighlightRow")) return;
$('.HighlightRow').removeClass("HighlightRow");
newHighlightDiv.addClass('HighlightRow');
var activeHomeID = newHighlightDiv.attr("id");
if (activeHomeMarkerID) {
map.markers[activeHomeMarkerID].setIcon('http://example.com/images/house-icon.png');
}
activeHomeMarkerID = activeHomeID.substring(4);
map.markers[activeHomeMarkerID].setIcon('http://example.com/images/house-icon-active.png');
});
UPDATE 2:
So, I applied the timer parameter below and in IE, it is still just as slow. Any other ideas?