Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const animaisList = document.querySelector('.animais-lista');
- function calback(even){
- console.log(even.target);
- }
- animaisList.addEventListener('click',calback);
- const img = document.querySelector('img');
- function calback(){
- console.log("Clicou");
- }
- img.addEventListener('click',calback);
- const animaislista = document.querySelector('.animais-lista');
- function callback(event){
- console.log(event.target)
- }
- animaislista.addEventListener('click', callback)
- const linkExterno = document.querySelector('a[href^="http"]');
- function callback_(event){
- event.preventDefault();
- console.log(this.getAttribute('href'));
- console.log(event.target.href);
- }
- linkExterno.addEventListener('click',callback_);
- const h1 = document.querySelector("h1");
- function mouseEvent(event){
- console.log(event.type, event);
- }
- h1.addEventListener('mouseenter',mouseEvent);
- window.addEventListener('scroll',mouseEvent)
- window.addEventListener('resize',mouseEvent);
- window.addEventListener('keydown', mouseEvent);
- function keyBoard(event){
- if(event.key=='a'){
- console.log(event.key);
- }else if(event.key=='v'){
- console.log(event.key);
- }
- }
- window.addEventListener('keydown',keyBoard);
- function key(event){
- if(event.key=='f'){
- document.body.classList.toggle('fullscrem');
- }
- }
- window.addEventListener('keydown',key);
- function handleimg(event){
- console.log(event.target.getAttribute('src'))
- }
- const imgs = document.querySelectorAll('img');
- imgs.forEach((event)=>{
- event.addEventListener('click',handleimg)
- })
- const links = document.querySelectorAll('a[href^="#"]');
- function handleLink(event){
- event.preventDefault();
- links.forEach((link)=>{
- link.classList.remove("ativo");
- })
- event.currentTarget.classList.add('ativo');
- }
- links.forEach((link)=>{
- link.addEventListener('click',handleLink)
- })
- function handlElemento(event){
- //console.log(event.currentTarget.remove())
- }
- const todoselementos = document.querySelectorAll('body *');
- todoselementos.forEach((elemento)=>{
- elemento.addEventListener('click',handlElemento)
- });
- function bigText(event){
- if(event.key==='t'){
- document.documentElement.classList.toggle('textoMaior');
- }
- }
- window.addEventListener('keydown',bigText)
Add Comment
Please, Sign In to add comment