js实现下一页页码效果


Posted in Javascript onMarch 07, 2017

效果图:

js实现下一页页码效果

代码如下:

<!DOCTYPE html>
<html>
 <head>
 <meta charset="utf-8" />
 <title></title>
 <style>
  *{
  margin: 0;
  padding: 0;
  }
  .scroll-tool{
  position: relative;
  height: 56px;
  padding: 12px 160px;
  background-color: #f9f9f9;
  }
  .st-con{
  font-size: 14px;
  line-height: 30px;
  text-align: center;
  padding: 12px 0;
  width: 680px;
  margin: 0 auto;
  overflow-y: hidden;
  overflow-x: auto;
  white-space: nowrap;
  }
  .st-con .img-page{
  font-size: 0;
  }
  a{
  text-decoration: none;
  }
  .st-con a.selected{
  background-color: #d3a12a;
  }
  .st-con a{
  font-size: 14px;
  display: inline-block;
  width: 30px;
  height: 30px;
  color: #fff;
  border-radius: 3px;
  background-color: #44c6ea;
  margin: 0 5px;
  }
  html,body{
  background: #f0f0f0;
  font: 14px/2 "微软雅黑";
  }
  header{
  width: 680px;
  height: 50px;
  margin: 50px auto;
  }
  header div{
  width: 100%;
  height: 50px;
  line-height: 50px;
  text-align: center;
  font-size: 30px;
  color: #999;
  }
 </style>
 </head>
 <body>
 <header>
  <div>
  简约下一页页码效果
  </div>
 </header>
 <div class="scroll-tool">
  <div class="st-con">
  <div class="img-page">
   <a href="javacript:void(0)" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="selected"><span>1</span></a>
   <a href="javacript:void(0)" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ><span>2</span></a>
   <a href="javacript:void(0)" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ><span>3</span></a>
   <a href="javacript:void(0)" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ><span>4</span></a>
                    <a href="javacript:void(0)" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ><span>5</span></a>
      <a href="javacript:void(0)" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ><span>6</span></a>
  </div>
  </div>
 </div>
 <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
 <script>
  $(function(){
  $('.img-page a').on('click',function(){
   $(this).addClass('selected').siblings('a').removeClass('selected');
  })
  })
 </script>
 </body>
</html>

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持三水点靠木!

Javascript 相关文章推荐
Script的加载方法小结
Jan 12 Javascript
javascript 使用 NodeList需要注意的问题
Mar 04 Javascript
javascript常用方法汇总
Dec 02 Javascript
jQuery中:last选择器用法实例
Dec 30 Javascript
Bootstrap表单布局样式源代码
Jul 04 Javascript
jQuery获取复选框选中的当前行的某个字段的值
Sep 15 jQuery
jQuery中 DOM节点操作方法大全
Oct 12 jQuery
在微信小程序里使用watch和computed的方法
Aug 02 Javascript
微信小程序textarea层级过高的解决方法
Mar 04 Javascript
JavaScript中的函数申明、函数表达式、箭头函数
Dec 06 Javascript
js实现小球在页面规定的区域运动
Jun 16 Javascript
jQuery实现移动端扭蛋机抽奖
Nov 08 jQuery
原生JS中slice()方法和splice()区别
Mar 06 #Javascript
浅析vue component 组件使用
Mar 06 #Javascript
js常用的继承--组合式继承
Mar 06 #Javascript
VUE开发一个图片轮播的组件示例代码
Mar 06 #Javascript
canvas仿iwatch时钟效果
Mar 06 #Javascript
jQuery滚动监听实现商城楼梯式导航效果
Mar 06 #Javascript
纯JS实现弹性导航条效果
Mar 06 #Javascript
You might like
php生成随机数的三种方法
2014/09/10 PHP
jQuery获取json后使用zy_tmpl生成下拉菜单
2015/03/27 PHP
PHP 7.1新特性的汇总介绍
2016/12/16 PHP
PHP发送邮件确认验证注册功能示例【修改别人邮件类】
2019/11/09 PHP
一个获取第n个元素节点的js函数
2014/09/02 Javascript
JavaScript实现找出字符串中第一个不重复的字符
2014/09/03 Javascript
JavaScript sup方法入门实例(把字符串显示为上标)
2014/10/20 Javascript
Jquery修改页面标题title其它JS失效的解决方法
2014/10/31 Javascript
node.js下when.js 的异步编程实践
2014/12/03 Javascript
javascript中createElement的两种创建方式
2015/05/14 Javascript
对jquery的ajax进行二次封装以及ajax缓存代理组件:AjaxCache详解
2016/04/11 Javascript
JS 数字转换为大写金额的简单实例
2016/08/04 Javascript
JS调用某段SQL语句的方法
2016/10/20 Javascript
jQuery插件zTree实现删除树子节点的方法示例
2017/03/08 Javascript
JavaScript中常见内置函数用法示例
2018/05/14 Javascript
jquery实现烟花效果(面向对象)
2020/03/10 jQuery
python list排序的两种方法及实例讲解
2017/03/20 Python
在Python 2.7即将停止支持时,我们为你带来了一份python 3.x迁移指南
2018/01/30 Python
pandas 对series和dataframe进行排序的实例
2018/06/09 Python
Python3爬虫爬取英雄联盟高清桌面壁纸功能示例【基于Scrapy框架】
2018/12/05 Python
33个Python爬虫项目实战(推荐)
2019/07/08 Python
Python之Class&amp;Object用法详解
2019/12/25 Python
Python使用requests xpath 并开启多线程爬取西刺代理ip实例
2020/03/06 Python
Scrapy框架介绍之Puppeteer渲染的使用
2020/06/19 Python
python 中的9个实用技巧,助你提高开发效率
2020/08/30 Python
Python lxml库的简单介绍及基本使用讲解
2020/12/22 Python
实例讲解利用HTML5 Canvas API操作图形旋转的方法
2016/03/22 HTML / CSS
PHP开发工程师面试问题集锦
2012/11/01 面试题
数据库方面面试题
2012/04/22 面试题
Python里面search()和match()的区别
2016/09/21 面试题
机电专业个人自荐信格式模板
2013/09/23 职场文书
采购部岗位职责
2013/11/24 职场文书
公证书格式
2015/01/23 职场文书
事业单位个人总结
2015/02/12 职场文书
MySQL CHAR和VARCHAR该如何选择
2021/05/31 MySQL
数据分析数据库ClickHouse在大数据领域应用实践
2022/04/03 MySQL