abstrak:<html> <head> <title>手風琴菜單</title> <script src="js/jquery.js" type="text/javascript">&
<html> <head> <title>手風琴菜單</title> <script src="js/jquery.js" type="text/javascript"> </script> <style type="text/css"> *{ margin: 0; padding: 0; font-size: 14px; font-family: "微軟雅黑"} a{ text-decoration: none; color: #36b2f5;} .nav{ width: 250px; margin: 50px auto; border-bottom: 3px solid #36b2f5;border-top: 4px solid #36b2f5;} .one{ width:250px; height: 40px; line-height: 40px;text-align: center; border-left: 1px solid #36b2f5;border-right: 1px solid #36b2f5;border-bottom: 1px solid #36b2f5;} .two{ width: 250px; text-align: center; border-left: 1px solid #36b2f5;border-right: 1px solid #36b2f5;} .two div{ height: 35px; line-height: 35px;border-bottom: 1px dotted #36b2f5;} </style> <script type="text/javascript"> $(function(){ $(".two").css("display","none");//使用css方式隱藏 //$(".two").hide();//使用hide函數(shù)方式隱藏 let one = $(".one"); let two = $(".two"); $(".one").each(function(i){ $(this).click(function(){ if($(two[i]).css("display")=="none"){ $(two[i]).slideDown(400); }else{ $(two[i]).slideUp(400); } }); }); }) </script> </head> <body> <div class="nav"> <div class="parent"> <div class="one"> <strong>個人中心</strong> </div> <div class="two"> <div><a href="#">我的信息</a></div> <div><a href="#">系統(tǒng)通知</a></div> <div><a href="#">短信息</a></div> </div> </div> <div class="parent"> <div class="one"> <strong>課程中心</strong> </div> <div class="two"> <div><a href="#">課程1</a></div> <div><a href="#">課程2</a></div> <div><a href="#">課程3</a></div> </div> </div> <div class="parent"> <div class="one"> <strong>校內(nèi)討論</strong> </div> <div class="two"> <div><a href="#">校內(nèi)討論1</a></div> <div><a href="#">校內(nèi)討論2</a></div> <div><a href="#">校內(nèi)討論3</a></div> </div> </div> <div class="parent"> <div class="one"> <strong>我的課程</strong> </div> <div class="two"> <div><a href="#">我的課程1</a></div> <div><a href="#">我的課程2</a></div> <div><a href="#">我的課程3</a></div> </div> </div> </div> </body> </html>
Guru membetulkan:查無此人Masa pembetulan:2019-04-27 17:30:18
Rumusan guru:完成的不錯,可以把常用的css樣式寫到一個文件,下次直接可以使用。繼續(xù)加油