HTML #左侧菜单

###

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .headcolor{
            background-color: gray;
            height: 100px;

        }
        .bodycolor{
            background-color: green;
            width: 50px;
        }
        .hide{
            display: none;
        }
        .content1{
            color: red;
        }
    </style>
</head>
<body style="margin: 0">
    <div class="headcolor">111</div>
    <div>
        <div>
            <div id="i1" class="bodycolor" onclick="hide(‘i1‘)">菜单一</div>
            <div class="hide">
                <div>内容1</div>
                <div>内容2</div>
                <div>内容3</div>
            </div>
        </div>
        <div>
        <div id="i2" class="bodycolor" onclick="hide(‘i2‘)">菜单二</div>
            <div class="hide">
                <div>内容1</div>
                <div>内容2</div>
                <div>内容3</div>
            </div>
        </div>
        <div>
        <div id="i3" class="bodycolor" onclick="hide(‘i3‘)">菜单三</div>
            <div class="hide">
                <div>内容1</div>
                <div>内容2</div>
                <div>内容3</div>
            </div>
        </div>
        </div>
    <script>
        function hide(nid) {
            var d = document.getElementById(nid);
            var item_list = d.parentElement.parentElement.children;
            console.log(d);
            for(var i=0;i<item_list.length;i++){
                item_list[i].children[1].classList.add(‘hide‘);
            }
            d.nextElementSibling.classList.remove("hide")
        }
//        function hide(nid) {
//            var d = document.getElementById(nid);
//
//            console.log(d);
//            d.nextElementSibling.classList.remove(‘hide‘);
//            }
    </script>
</body>
</html>

###

.headcolor { background-color: gray; height: 100px }
.bodycolor { background-color: green; width: 50px }
.hide { display: none }
.content1 { color: red }

菜单一

内容1

内容2

内容3

菜单二

内容1

内容2

内容3

菜单三

内容1

内容2

内容3

时间: 2024-08-29 20:47:12

HTML #左侧菜单的相关文章

JavaScript内容梳理 示例之模态对话框 示例之全选和反选以及取消 示例之后台管理左侧菜单

1 <!DOCTYPE html> 2 <!--示例之模态对话框--> 3 <html lang="en"> 4 <head> 5 <meta charset="UTF-8"> 6 <title>Title</title> 7 <style> 8 .hide{ 9 display: none; 10 } 11 .c1{ 12 position: fixed; 13 lef

python : jquery实现左侧菜单

左侧菜单 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Title</title> <style> .header{ background-color: black; color: wheat;

python : HTML+CSS (左侧菜单)

左侧菜单 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Title</title> <style> .hide{ display: none; } .menu .head{ height:38px

亚马逊左侧菜单延迟z三角 jquery插件jquery.menu-aim.js源码解读

关于亚马逊的左侧菜单延迟,之前一直不知道它的实现原理.梦神提到了z三角,我也不知道这是什么东西.13号那天很有空,等领导们签字完我就可以走了.下午的时候,找到了一篇博客:http://jayuh.com/amazon-site-navigation/ 它提到亚马逊左侧菜单的秘密在于它有一个三角形的缓冲延迟区域. 当鼠标在这个蓝色范围内移动时,会有延迟,所以右侧的二级菜单才不会马上变化. 顺着博客在github找到了这个插件:https://github.com/jayuh/jQuery-menu

今天在做后台管理系统的无刷新左侧菜单,遇到两个难题:(CTE递归查询、ashx+Session[])

今天在做后台管理系统的无刷新左侧菜单,遇到两个难题: 1.怎么将数据表中的菜单项按树形结构进行层次性的查询?群里有人给我指点说用CTE递归查询,我还没搞明白. 2.要做左侧导航栏的根据用户权限的无刷新加载时,要用到AJAX,那么就要在ashx一般处理程序中取得Session["UserID"]的值,但是ashx中是不能用Session的,之后找到一篇文章,指出:若要在ashx中使用Session和Request需要引入一个接口. 在ashx文件中使用Session和QueryStrin

Ionic 左侧菜单(登录主页详情demo)

1.项目结构 2.截图效果展示        3.主要js 代码 1 $stateProvider 2 .state('app', { 3 url: "/app", 4 abstract: true, 5 templateUrl: "templates/menu.html", 6 controller: 'MenuCtrl' 7 }) 8 //用户 9 .state('login', { 10 url: '/login', 11 templateUrl: 'temp

鼠标滑动一定距离的左侧菜单置顶效果

如图:上述实现的是鼠标向下滑动90px,左侧菜单整体上移置顶,而菜单在最开始便进行了定位,距离顶部90px 以下为实现这个效果的js代码: /*鼠标滑动一定距离的菜单效果*/ $(document).scroll(function() { var top=$(this).scrollTop(); console.log(top); if(top>90) { $(".sidebar").css("top","0"); } if(top<

ace admin 左侧菜单定位

后台模版来自:Ace Admin http://ace.jeka.by/form-elements.html 左侧菜单,通过js根据url来判断显示哪块 window.location.pathname: 代表URL 的路径部分(就是文件地址) 本例返回值:/Company/AddOrEditCompany window.location.search: 代表查询(参数)部分 除了给动态语言赋值以外,我们同样可以给静态页面,并使用javascript来获得相信应的参数值 本例返回值:?id=6

jquery实现左侧菜单 效果

html <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>左侧菜单</title> <script type="text/javascript" src="js/jquery-3.0.0.min.js" ></script> <script type="text

一款jQuery插件+CSS打造的左侧菜单效果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-