0

I am trying to create sliders and I am trying to accomplish this without jQuery (a personal challenge).

I have a constructor function with multiple instances.

function Slider(container){ 
   // some code
}

slider  = new Slider();
slider2 = new Slider();

I have created prototype function which is attached to the event 'onmousedown'.

Slider.prototype.mouseDown = function(){ 
   // 'this' now refers to the element, not the object instance. 
}

When mouseDown is activated i want to attach a prototype function to the event 'onmousemove'. Preferably something like this.

Slider.prototype.mouseDown = function(){
   this.onmousemove = this.mouseMove;
}

Any suggestions as to how I can access the object instance in a situation where the context has changed?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Andrew Nielsen
  • 113
  • 1
  • 8

0 Answers0