这次给大家带来利用JS实现下拉框功能,利用JS实现下拉框功能的注意事项有哪些,下面就是实战案例,一起来看一下。
="content-type"content=> =>
*{padding: 0;margin:0;}
ul,li{list-style: none}
.left{float: left;}
.right{float: right;}
.select_contain{font-size: 14px;color: #333;line-height: 38px;margin: 30px 0;}
.select_item{margin-right: 50px;position: relative;}
.select_tit{margin-right: 20px;}
.select_result{width: 100px;line-height: 38px;border:1px solid #ccc;text-align: center;border-radius: 4px;text-indent: -8px;cursor:pointer;}
.select_result .triangle{border:5px solid transparent;border-top:5px solid #666;position: absolute;top: 16px; right:8px;}
.select_item ul{display:none;position:absolute;top:100%;right:0;width:100px;background: #f3f3f3;border:1px solid #ccc;border-radius:0 0 4px 4px; border-top-color:#f3f3f3;margin-top:-4px;}
.select_item ul li{text-align: center;cursor: pointer;}
.select_item ul li:hover{background: #f4a100; color: #fff;}
<scriptsrc=>=>
<script>
function select(){
$(document).click(function(){
$(".select_module_con ul").slideUp();
})
var module=$(".select_result");
module.click(function(e){
e.stopPropagation();
var ul=$(this).next();
ul.stop().slideToggle();
ul.children().click(function(e){
e.stopPropagation();
$(this).parent().prev().children("span").text($(this).text());
ul.stop().slideUp();
})
})
}
$(function(){
select();
})
</script>
="select_contain">
=>
=>
=>
="select_result">
选择节目
="triangle">相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
推荐阅读:
简单蓝色后台管理模板,蓝色风格,包含登录页面login.html及后台操作页面两个模板页面,后台操作页面是框架结构(Frame)布局,右侧下拉式导航菜单,设计上体现了对用户操作的考虑,是您开发一般后台的首选。有关于我们、新闻中心、产品中心、客户服务、经典案例、高级管理、系统管理、个人管理等系统功能菜单。
555
以上就是利用JS实现下拉框功能的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号