views:

33

answers:

1

HI,

I am making my own scroll bar. in which i made this code below i pasted. i am getting the issue from this code.

i) in the first time i am pressing "#scroller" that works fine.

ii) in case of second or other time when i am enter into "#scroller" itself, i am getting the alert "hi", instead of i am pressing the "#scroller", i know that i am doing some wrong this with my code, but i unable to find the mistake.

Any one help me?

$(function(){ var slidesWidth = ($('#show-content li').length)*($('#show-content li').width()+20);

$('#show-content ul').width(slidesWidth);

var scrollBarWidth = (100/slidesWidth)*1000;//presently taken by manual/

$('#scroller').width(scrollBarWidth);

$('#scroller').bind('mousedown',function(){

      $('#scroller').mousemove(function(){
            alert('hi');        
        }) 

})

$('#scroller').bind('mouseup',function(){

      $('#scroller').unbind('mousedown,mousemove');
      alert('unbinded');

})

})

+1  A: 

#scroller's mousemove event may not have been unbound. Try this when you unbind.

$('#scroller').unbind('mousedown').unbind('mousemove');
bobthabuilda
No, this is not work!
3gwebtrain
it is cancel the total mouse down and move, i unable to switch back to events, what we need.
3gwebtrain