移动端省市列表索引

来源:https://www.sucaihuo.com/js/3038.html 2017-09-18 21:06浏览(642) 收藏

一款移动端省市索引列表的特效,可以点选右侧相应的字母,如果有数据则自动跳至对应数据内容,没有对应数据则停留在当前内容。
移动端省市列表索引
分类:文字特效 > 文字列表 难易:初级
查看演示 下载资源 下载积分: 20 积分

页面的head部分,需设置好页面元素的样式,代码如下:

*{padding: 0;margin: 0;box-sizing:border-box;}
body,html{width: 100%;height: 100%;font-family: Helvetica}
#btn{padding:14px;font-size: 14px;color: #fff;border-radius: 6px;background-color: #337ab7;border: none;}
#list{font-size: 16px;position: relative;height: 100%}
#list>section{overflow-y: auto;height: 100%}
#list>section>dl>dt{background: #f7f7f9;color: #999;height:40px;line-height:40px;padding-left: 15px;}
#list>section>dl>dd{font-size: 16px;color: #333;line-height:40px;padding-left: 15px;position: relative;}
#list>section>dl>dd:after{content:'';position: absolute;left: 0;bottom: 1px;width: 100%;height: 1px;background-color:#c8c7cc;transform:scaleY(.5);-webkit-transform:scaleY(.5);}
#list>section>dl>dd:last-of-type:after{display: none;}
#navBar{position: absolute;width:26px;height: 100%;right: 0;top: 0}
#navBar.active{background:rgba(211,211,211,.6);}
#navBar>a{text-align: center;display: block;text-decoration:none;height: 4.166%;line-height:100%;color: #333;font-size: 13px;}
#prompt{position: fixed;left: 50%;top:50%;margin:-30px 0 0 -30px;width: 60px;height: 60px;text-align: center;line-height: 60px;font-size: 30px;color: #fff;background: rgba(0,0,0,0.5);z-index: 10;display: none;border-radius:4px;}
#prompt.active{display:block;}

页面的body部分,仅需设置一个指定id的div容器即可,代码如下:

<div id='list'></div>

页面的底部,需引入zepto库和必要的JS插件,并对指定元素启用插件,代码如下:

<script type="text/javascript" src='js/zepto.min.js'></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
$('#list').myList()
</script>
评论0
头像

系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791

1 2