Reputation: 33307
I have the following html code:
<div id="scroll-box">
<div id="header" style="position:fixed">...</div>
<div id="main">...</div>
</div>
I tried to delegate the scroll event of the scroll-box event if the user scrolls with the mouse over the header:
$('#scroll-box').delegate('#header', 'scroll', function(){
alert("scroll");
});
This is not working. How can I trigger the scroll event of the scroll-box even if the mouse is over the header and the user scrolls?
Upvotes: 1
Views: 1211
Reputation: 6680
You can't delegate the scroll event because the scroll event doesn't bubble. Delegation works only for events that bubble.
Upvotes: 2