0

do not hesitate to redirect on answer.

In javascrit I write fly function like with:

class TOTO{
constructor() {
    this.zoomLevel = 1.0;
    //...code...//
    
    this.elementpageWeb.onwheel = function(event){ 
        console.log("I pass here");
        console.log("zoom level = "+this.zoomLevel);
        return false; 
    };

My code works, when I call TOTO class and I move mouseWheel the console.log draw "I pass here" but the variable "this.zoomLevel" is undefined. Than I would like is 1 because is defined just before.

I don't understand how pass and use variable of the class where the function is called.

Heretic Monkey
  • 11,078
  • 7
  • 55
  • 112
carton99
  • 33
  • 4

0 Answers0