1

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?

Michael
  • 32,527
  • 49
  • 210
  • 370
  • Well this question is answered here. http://stackoverflow.com/questions/16505182/bind-scroll-event-to-dynamic-div/31498537#31498537 – Bikal Basnet Jul 19 '15 at 06:35

1 Answers1

2

You can't delegate the scroll event because the scroll event doesn't bubble. Delegation works only for events that bubble.

John Kurlak
  • 6,594
  • 7
  • 43
  • 59