jquery营业时间选择器效果
代码语言:html
所属分类:选择器
代码描述:jquery营业时间选择器效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>一周内时间区间选择</title> <style> * { margin: 0; padding: 0; list-style: none; } #data { width: 750px; border: 1px solid #ccc; background-color: white; } #data #data_top { display: flex; justify-content: flex-end; padding: 15px 20px; } #data #data_top dd { width: 15px; height: 15px; background-color: #c0e2fd; margin-right: 10px; } #data #data_top dl:nth-child(2) dd { background-color: white; border: 1px solid #ccc; margin-left: 50px; } #data #data_top dl { display: flex; align-items: center; } #data #data_top dt { font-size: 13px; color: #999; } #data_body { padding: 30px; background-color: #f7f7f7; border-top: 1px solid #ccc; } #data_body_top { display: flex; margin-bottom: 5px; } #data_body_top p { width: 52px; font-size: 12px; text-align: center; color: #666; } #data_body ul>li { display: flex; } #data_body ol li { width: 25px; height: 25px; background-color: white; border-top: 1px solid #eee; border-right: 1px solid #eee; } #data_body ol li:nth-child(1) { border-left: 1px solid #ccc; } #data_body ol { display: flex; /*margin-left: 20px;*/ } #data_body ul>li p { width: 25px; height: 25px; font-size: 12px; line-height: 25px; } </style> <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script> <script> $(function() { init(); var data_list = {}; $("#data_body ul>li ol>li").click(function() { var back = $(this).css("background-color"); var $column_index = $(this).index(); var $row_index = ($(this).parent().parent().index() + 1).toString(); if(back == "rgb(195, 224, 254)") { $(this).css("background-color", "#fff"); //删除时间 for(var i = 0; i < data_list[$row_index].length; i++) { if(data_list[$row_index][i] == $column_index) { data_list[$row_index].splice(i, 1); } } } else { $(this).css("background-color", "#.........完整代码请登录后点击上方下载按钮下载查看
网友评论0