[英]HTML5 and CSS3 tree menu with nice hover effect
我想使用HTML5和CSS3或jquery菜單或某種方式使用普通的html,css和javascript實現樹形菜單,例如鏈接波紋管。
http://www.crystal.ch/abb/power_systems_landscape/
您可能會注意到其中涉及以下問題,
同樣在這里,您會看到平滑地上下滑動,這對我來說不是問題。
任何想法或參考將不勝感激。 謝謝
首先,我們需要HTML
<p class="menu_head">first</p>
<div class="menu_body">
<a href="">1</a>
<a href="">2</a>
<a href="">3</a>
<a href="">4</a>
</div>
<p class="menu_head1">Second</p>
<div class="menu_body">
<a href="">1</a>
</div>
jQuery的效果
$("#firstpane p.menu_head").click(function()
{
$(this).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
});
$("#firstpane p.menu_head1").click(function()
{
$(this).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
});
$("#firstpane p.menu_head").mouseover(function()
{
$(this).css("text-indent","35px");
$(this).css("backgroundImage","url(images/trans.png)").fadeTo("slow",0.33);
});
$("#firstpane p.menu_head").mouseout(function()
{
$(this).css("text-indent","10px");
$(this).css("backgroundImage","url(images/headbot1.png)").fadeTo("slow", 1);
});
我為您的玻璃效果添加了mouseover和mouseout。 只需創建具有白色或任何顏色的背景,或僅刪除.css即可實現此目的。
$(this).fadeTo("slow",0.33);
的CSS
.menu_head {
font-family: arial;font-weight: bold;
font-size:10px;
color: black;
left:3%;
height:7px;
text-indent:10px;
padding: 10px 10px;
cursor: pointer;
position: relative;
margin:1px;
font-weight:bold;
vertical-align: middle;
}
.menu_head1 {
font-family: arial;font-weight: bold;
font-size:10px;
color: black;
left:3%;
height:7px;
text-indent:10px;
padding: 10px 10px;
cursor: pointer;
position: relative;
margin:1px;
font-weight:bold;
vertical-align: middle;
}
.menu_body {
display:none;
}
.menu_body a{
font-family: arial;font-weight: bold;
left:3%;
width: 220px;
height:7px;
text-indent:10px;
position:relative;
padding: 10px 15px;
display:block;
color:#006699;
padding-left:10px;
font-weight:bold;
font-size:10px;
text-decoration:none;
vertical-align: middle;
}
參見示例
嘗試編輯CSS,以使其適應我的網站。 古德魯克
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.