Javascript examples for DOM:Mouse Event
Add fade effect with mouse over event
<!doctype html> <html> <head> <title>example</title> <style> div{//w w w.j a v a2s. c o m background-color:#fc0; -webkit-transition:opacity 1500ms ease; opacity:1; } div.hide{ opacity:0; } </style> <script> var changeclass=function(){ this.classList.add('hide'); } window.onload=function(){ var firstDiv=document.getElementsByTagName('div')[0]; firstDiv.addEventListener('mouseover',changeclass,false); } </script> </head> <body> <div> Hello </div> </body> </html>