简体   繁体   English

HTML5和CSS3树形菜单具有很好的悬停效果

[英]HTML5 and CSS3 tree menu with nice hover effect

I would like to implement a tree menu like the link bellow using HTML5 and CSS3 or jquery menu or somehow using ordinary html, css and javascript . 我想使用HTML5和CSS3或jquery菜单或某种方式使用普通的html,css和javascript实现树形菜单,例如链接波纹管。

http://www.crystal.ch/abb/power_systems_landscape/ http://www.crystal.ch/abb/power_systems_landscape/

You may notice that there is following issues involved, 您可能会注意到其中涉及以下问题,

  1. Nice hover effect (I badly need this) 悬停效果好(我非常需要此功能)
  2. Rotation of menu item arrow icon 旋转菜单项箭头图标

Also here you see sliding up and down smoothly that is not problem to me. 同样在这里,您会看到平滑地上下滑动,这对我来说不是问题。

Any idea or reference would be appreciated. 任何想法或参考将不胜感激。 thanks 谢谢

To start we need the HTML 首先,我们需要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 for the effect 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);    
});

I added the mouseover and mouseout for your glass effect. 我为您的玻璃效果添加了mouseover和mouseout。 just create a background with white color or any color or just erase the .css can make it this way. 只需创建具有白色或任何颜色的背景,或仅删除.css即可实现此目的。

$(this).fadeTo("slow",0.33);

CSS 的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;
}​

See Example 参见示例

try to edit the css for it was made to adapt to my site. 尝试编辑CSS,以使其适应我的网站。 Gudluck 古德鲁克

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM