复制代码 代码如下:
<!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-Type" content="text/html; charset=utf-8" />
<title>jquery用ul模拟表单select列表菜单效果</title>
<script type="text/javascript" src="/UploadFiles/2021-04-02/jquery.min.js"><style type="text/css">
<!--
body {padding:10px;}
* {margin:0; padding:0; font-size:12px;}
ul,li {list-style-type:none;}
.select_box {width:150px; border:1px solid #ccc; padding-right:20px; padding-left:10px; background:url(107.gif) no-repeat 160px center; position:relative;}
.select_box span {cursor:pointer; display:block; line-height:25px; width:100%; height:25px; overflow:hidden;}
.select_box ul li {cursor:pointer;}
.son_ul {width:179px; position:absolute; left:0; top:25px; border:1px dashed #ccc; background:#fff;}
.son_ul li {display:block; line-height:25px; padding-left:10px; width:169px}
.hover {background:#ccc;}
-->
</style>
<script type="text/javascript">
$(document).ready(function(){
$('.son_ul').hide(); //初始ul隐藏
$('.select_box span').hover(function(){ //鼠标移动函数
$(this).parent().find('ul.son_ul').slideDown(); //找到ul.son_ul显示
$(this).parent().find('li').hover(function(){$(this).addClass('hover')},function(){$(this).removeClass('hover')}); //li的hover效果
$(this).parent().hover(function(){},
function(){
$(this).parent().find("ul.son_ul").slideUp();
}
);
},function(){}
);
$('ul.son_ul li').click(function(){
$(this).parents('li').find('span').html($(this).html());
$(this).parents('li').find('ul').slideUp();
});
}
);
</script>
</head>
<body>
<ul id="main_box">
<li class="select_box">
<span>请选择...</span>
<ul class="son_ul">
<li>选项一</li>
<li>选项二</li>
<li>选项三</li>
<li>选项四</li>
<li>选项五</li>
</ul>
</li>
</ul>
</body>
</html>

实现结果
jquery+css+ul模拟列表菜单具体实现思路 
打完收工!
标签:
菜单,列表

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
评论“jquery+css+ul模拟列表菜单具体实现思路”
暂无“jquery+css+ul模拟列表菜单具体实现思路”评论...

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。