Search code examples
javascriptjqueryhtmlpluginstinyscrollbar

Jquery scroll() function is not working


here i have used tinyscrollbar for following code. so here i write scroll event for the tinyscrollbar but it is not working . can you help me ?

<div id="scrollbar1" class="scrollBox">
  <div class="scrollbar">
    <div class="track">
      <div class="thumb">
        <div class="end"></div>
      </div>
    </div>
  </div>
  <div class="viewport">
    <div class="overview">
    gula id tortor ornare luctus. Integer placerat urna non ligula sollicitudin vestibulum. Nunc vestibulum auctor massa, at varius nibh scelerisque eget. Aliquam convallis,
        </div>
              </div>
                </div>

Please see the example http://jsfiddle.net/rushijogle/7u377/7/

 $("#scrollbar1 .viewport").scroll(function(){

  alert("Scroller is scrolling :")

     });

The above function is not working ... thanx in adavcne :)


Solution

  • SEE THE DEMO

    JS Code -

    $('#scrollbar1').tinyscrollbar();
    
    $("#scrollbar1").on('mousewheel DOMMouseScroll', function() {
        onScroll();
    });
    $("#scrollbar1").on('mouseup', '.scrollbar', function(){
        onScroll();
    });
    
    function onScroll(){
        alert('Scrolling');
    }