Do not catch the ES6 Javascript effect

1

I have a problem. I do not apply the effect when I click, only when I add the variable enlance.addEventListener () in the console, calling the design class with the transition method but when I click nop, will someone know why? compile with node.js and I get this:

let enlance = document.getElementById('sign');
              ^

ReferenceError: document is not defined
    at Object.<anonymous> (C:\Users\Aisak\Desktop\Repository\ShopList\js\eventos.js:39:15)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)


 class Design{
    transitionUp(up, down){
       this.up = up;
       this.down = down;
       this.up.style.transform = "translateY(-1000%)";
       this.down.style.transform = "translateY(0%)";
    }
    transitionDown(up,down){
        this.up = up;
        this.down = down;
        this.up.style.transform = "translateY(0%)";
        this.down.style.transform ="translateY(-1000%)";
        this.down.style.transition="all 3s";
        this.up.style.transition="all 1.3s"; 
    }
}

const diseño = new Design();
let enlance = document.getElementById('sign');
let enlance2 = document.getElementById('sign2');
let loguin = document.getElementById('loguin');
let registro = document.getElementById('registro');
enlance.addEventListener('click', diseño.transitionUp(loguin,registro));
enlance2.addEventListener('click', diseño.transitionDown(loguin,registro));

    
asked by Aisakk 01.01.2019 в 23:44
source

1 answer

0

If you want to pass parameters to the listener function, you must use anonymous functions.

var el = document.getElementById("t"); 
el.addEventListener("click", function(){modifyText("four")}, false); 

link

    
answered by 02.01.2019 в 01:36