3gwebtrain
3gwebtrain

Reputation: 15303

Mouse down Issue

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');

})

})

Upvotes: 0

Views: 810

Answers (1)

ground5hark
ground5hark

Reputation: 4514

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

$('#scroller').unbind('mousedown').unbind('mousemove');

Upvotes: 1

Related Questions