????:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>頁面中常用平級下拉菜單(手風(fēng)琴)</title> <link rel="
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>頁面中常用平級下拉菜單(手風(fēng)琴)</title> <link rel="shortcut icon" href="static/images/logo.png" type="image/x-icon"> <link rel="stylesheet" type="text/css" href="static/css/style.css"> <script type="text/javascript" src="static/js/jquery.js"></script> <script type="text/javascript"> $(function(){ /* $('.two').css('display','none') var one=$('.one'); //console.log(one); var two=$('.two'); //console.log(two); $('.one').each(function(i){ $(this).click(function(){ if($(two[i]).css('display')=='none'){ $(two[i]).slideDown(400) }else{ $(two[i]).slideUp(400) } }) }) */ $('.two').hide() $('.one').click(function(){ //console.log ($(this).next().css('display')=='none'); if($(this).next().css('display')=='none'){ $(this).next().slideDown(1000); }else{ $(this).next().slideUp(1000); } }) }) </script> </head> <body> <div> <div> <div> <strong>個人中心</strong> </div> <div> <div><a href="">我的信息</a></div> <div><a href="">系統(tǒng)通知</a></div> <div><a href="">短信息</a></div> </div> </div> <div> <div> <strong>課程中心</strong> </div> <div> <div><a href="">我的課程</a></div> <div><a href="">課程資源</a></div> <div><a href="">班級統(tǒng)計</a></div> <div><a href="">課程題庫</a></div> </div> </div> <div> <div> <strong>校內(nèi)討論</strong> </div> <div> <div><a href="">我的帖子</a></div> <div><a href="">新回復(fù)</a></div> <div><a href="">課程模塊</a></div> <div><a href="">問答中心</a></div> </div> </div> <div> <div> <strong>資源中心</strong> </div> <div> <div><a href="">教學(xué)資源</a></div> <div><a href="">教學(xué)經(jīng)歷</a></div> </div> </div> </div> </body> </html>
*{ margin: 0px; padding: 0px; font-size: 14px; font-family: "微軟雅黑" } a{ text-decoration: none; color: #36b2f5; } .nav{ width: 250px; margin:70px auto; border-top: 3px solid #36b2f5; border-bottom: 2px solid #36b2f5; } .nav .one{ 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: 248px; border-left: 1px solid #36b2f5; border-right: 1px solid #36b2f5; } .two div{ height: 35px; line-height: 35px; text-align: center; border-bottom: 1px dotted #36b2f5; }
總結(jié):通過這個案例,對于css中的一些細(xì)節(jié)理解更加清楚了,更加鞏固了jquery的使用。
?? ???:滅絕師太?? ??:2018-12-10 10:55:15
???? ??:完成的不錯,這都是頁面布局中常見的jq樣式,要好好掌握舉一反三