hi all,
i’m buliding an image slider object with the following code:
- function imageGalery(index, width){
- …
- this.isScrolling = false;
- …
- this.startScroll = function(){
- if(this.isScrolling == false){
- this.isScrolling = setInterval(‘galery’+index+‘.scroll();’,30);
- }
- }
- this.stopScroll = function(){
- clearInterval(this.isScrolling);
- this.isScrolling = false;
- }
- …
- img = document.createElement(‘img’);
- img.onmouseover = this.startScroll;
- img.onmouseout = this.stopScroll;
- …
- }
the thing is that it start scrolling only on the second time i hover the img…
i’m guessing it’s because the stopScroll method was already launched but i don’t understand why declaring the property isn’t enough.
i have also manged to bypass it by writing “eval(‘galery’+index)” (the object’s name) instead of “this” on line 6. can someone explain?