I do not apply the effect when I click, only when I add the variable enlance.addEventListener()
in the console, calling the class design
with the method transition
, but when I click it does not grab it.
Does anyone know why the effect does not apply?
I compiled with Node.js:
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));
let enlance = document.getElementById('sign');
This is the error:
ReferenceError: document is not defined at Object. (C: \ Users \ Aisak \ Desktop \ Repository \ ShopList \ js \ events.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)