abstract:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>jq的切換動(dòng)畫(huà)</title> &n
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>jq的切換動(dòng)畫(huà)</title> <script type="text/javascript" src="jquery.js"></script> <style type="text/css"> div{width: 200px;height: 200px;margin: 0 auto;border: 1px solid black;} button{display: block;margin: 0 auto;} </style> </head> <body> <div></div> <button>點(diǎn)擊顯示/隱藏</button> </body> <script type="text/javascript"> $(document).ready(function(){ $('div').hover(function(){ $(this).css('background','pink'); },function(){ $(this).css('background','#fff'); }) $('button').click(function(){ $('div').toggle(); }) }) </script> </html>
筆記:
hover(over,out)鼠標(biāo)的移入移出事件
toggle() 如果元素是可見(jiàn)的,就隱藏,否則相反
Correcting teacher:韋小寶Correction time:2019-03-10 13:21:54
Teacher's summary:寫(xiě)的很不錯(cuò) jQuery實(shí)現(xiàn)這些效果比js要簡(jiǎn)單的多了吧