时间:2021-07-11 08:41:20 | 栏目:JavaScript代码 | 点击:次
在使用导航栏时下拉列表不展示
没有下拉效果是这样的
经过修改后就解决了:
具体原因是没有导入:layui/layui.js
我的jsp代码是这样的:
<html> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="Cache-Control" content="no-siteapp" /> <link rel="shortcut icon" href="/favicon.ico" rel="external nofollow" type="image/x-icon" /> <link rel="stylesheet" href="/ssm/static/css/font.css" rel="external nofollow" > <link rel="stylesheet" href="/ssm/static/css/xadmin.css" rel="external nofollow" > <link rel="stylesheet" href="/ssm/static/lib/layui/css/layui.css" rel="external nofollow" /> <script type="text/javascript" src="/ssm/jquery/jquery-1.4.4.min.js"></script> <script src="/ssm/static/lib/layui/layui.all.js" charset="utf-8"></script> <script src="/ssm/static/lib/layui/layui.js" charset="utf-8"></script> <script type="text/javascript" src="/ssm/static/js/xadmin.js"></script> <head> <title>Title</title> </head> <script> //注意:导航 依赖 element 模块,否则无法进行功能性操作 layui.use('element', function(){ var element = layui.element; }); </script> <body> <ul class="layui-nav"> <li class="layui-nav-item"> <a href="">控制台<span class=" rel="external nofollow" layui-badge">9</span></a> </li> <li class="layui-nav-item"> <a href="">个人中心<span class=" rel="external nofollow" layui-badge-dot"></span></a> </li> <li class="layui-nav-item"> <a href=""><img src=" rel="external nofollow" //t.cn/RCzsdCq" class="layui-nav-img">我</a> <dl class="layui-nav-child"> <dd><a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" >修改信息</a></dd> <dd><a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" >安全管理</a></dd> <dd><a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" >退了</a></dd> </dl> </li> </ul> </body> </html>