1 2 3 4 5 示例 6 7 8 9 10 11 12

1314

15

16

17 1822 2327 2832 3337

3839404344 45

1 img 2 { 3 border: 0; 4 } 5 a 6 { 7 cursor: pointer; 8 color: #014ccc; 9 text-decoration: underline; 10 } 11 a:hover 12 { 13 text-decoration: none; 14 } 15 .clear 16 { 17 clear: both; 18 height: 0px; 19 overflow: hidden; 20 } 21 .img_list 22 { 23 margin: 0 auto; 24 } 25 .img_list li 26 { 27 list-style: none; 28 } 29 .img_list .items 30 { 31 margin: 0 auto; 32 } 33 .img_list .item 34 { 35 width: 260px; 36 float: left; 37 margin-bottom: 5px; 38 font-size: 14px; 39 } 40 .img_list .item .order 41 { 42 display: inline-block; 43 width: 28px; 44 color: #f30; 45 } 46 .img_list .item .i_thumb 47 { 48 width: 100%; 49 height: 280px; 50 } 51 .img_list .item .i_title 52 { 53 width: 100%; 54 height: 20px; 55 } 56 .showmore 57 { 58 height: 35px; 59 background: #f8f8f8; 60 border-bottom: 1px solid #cccccc; 61 cursor: pointer; 62 text-align: center; 63 margin-bottom: 25px; 64 } 65 .showmore .handle 66 { 67 display: block; 68 height: 35px; 69 text-align: center; 70 color: #909090; 71 font-size: 14px; 72 text-decoration: none; 73 line-height: 35px; 74 } 75 .showmore .handle:hover 76 { 77 text-decoration: none; 78 background: #e6e6e6; 79 } 80 .top 81 { 82 width: 100%; 83 height: 100px; 84 border: 1px solid #000; 85 } 86 .list 87 { 88 margin: 0 auto; 89 margin-top: 20px; 90 width: 1200px; 91 border: 1px solid #000; 92 } 93 @media screen and (min-width: 1201px) 94 { 95 .list 96 { 97 width: 1200px; 98 } 99 }100 /* css 注释说明:设置了浏览器宽度不小于1201px时 abc 显示1200px宽度 */101 /*102 @media screen and (max-width: 1200px)103 {104 .list105 {106 width: 900px;107 }108 }*/109 /* 设置了浏览器宽度不大于1200px时 abc 显示900px宽度 */110 /*111 @media screen and (max-width: 900px)112 {113 .list114 {115 width: 200px;116 }117 }118 */119 /* 设置了浏览器宽度不大于900px时 abc 显示200px宽度 */120 /*121 @media screen and (max-width: 500px)122 {123 .list124 {125 width: 100px;126 }127 }128 */129 /* 设置了浏览器宽度不大于500px时 abc 显示100px宽度 */

1 var iHeight = 0; 2 var iTop = 0; 3 var clientHeight = 0; 4 var iIntervalId = null; 5 var itemsSize = 0; 6 var pageNo = 1; // 当前页数,默认设为第 1 页 7 var pageSize = 4; // 每页显示的数量 8 9 getPageHeight(); 10 11 // 添加定时检测事件,每2秒检测一次 12 iIntervalId = setInterval("_onScroll();", 2000); 13 14 // 取得当前页面显示所占用的高度 15 function getPageHeight() { 16 if (document.body.clientHeight && document.documentElement.clientHeight) { 17 clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight; 18 } else { 19 20 clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight; 21 } 22 23 iHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 24 } 25 26 // 调用ajax取服务端数据 27 function show() { 28 // pageNo++; 29 // $.ajax({ 30 // url: 'Handler.ashx?p=' + pageNo + '&r=' + Math.random(), 31 // type: 'GET', 32 // dataType: 'text', 33 // timeout: 4000, 34 // beforeSend: showLoadingImg, 35 // error: showFailure, 36 // success: function (date){ 37 //把取出的数据转换为html 38 // } 39 // }); 40 showDate(); 41 } 42 43 function showDate() { 44 var pageOffset = (pageNo - 1) * pageSize + 1; 45 itemsSize = 8; 46 var nextpagehtml = ''; 47 for (i = 0; i < itemsSize; i++) { 48 nextpagehtml += ''; 49 nextpagehtml += '

'; 50 nextpagehtml += '

' + (pageOffset + i) + '链接'; 51 52 nextpagehtml += ''; 53 } 54 nextpagehtml += '

'; 55 $('#items').html($('#items').html() + nextpagehtml); 56 57 // 当前页码数小于3页时继续显示更多提示框 58 if (pageNo < 3) { 59 $('#showmore').html('显示更多结果'); 60 } else { 61 clearInterval(iIntervalId); 62 $('#showmore').hide(); 63 } 64 } 65 66 function showLoadingImg() { 67 $('#showmore').html('显示更多结果'); 68 } 69 70 function showFailure() { 71 $('#showmore').html('获取查询数据出错'); 72 } 73 74 // 判断滚动条是否到达底部 75 function reachBottom() { 76 var scrollTop = 0; 77 if (document.documentElement && document.documentElement.scrollTop) { 78 scrollTop = document.documentElement.scrollTop; 79 } else if (document.body) { 80 scrollTop = document.body.scrollTop; 81 } 82 if ((scrollTop > 0) && (scrollTop + clientHeight == iHeight)) { 83 return true; 84 } else { 85 return false; 86 } 87 } 88 89 // 检测事件,检测滚动条是否接近或到达页面的底部区域,0.99是为了更接近底部时 90 function _onScroll() { 91 iTop = document.documentElement.scrollTop + document.body.scrollTop; 92 getPageHeight(); 93 if (((iTop + clientHeight) > parseInt(iHeight * 0.99)) || reachBottom()) { 94 if (pageNo >= 3) { 95 clearInterval(iIntervalId); 96 $('#showmore').hide(); 97 return; 98 } 99 show();100 }101 };

初涉前端开发,一点小知识,积累下来自己用,贴出来大家共享,大侠自动飘过哈!

html怎么设置列表显示图片,网站图片列表动态显示、根据屏幕宽度动态设置DIV的CSS样式_html/css_WEB-ITnose...相关推荐

  1. html中图片不溢出,防止图片过大超出DIV的CSS样式

    防止图片过大超出DIV的CSS样式 内容导读:防止图片过大超出DIV的CSS样式有几种,大家可以根据页面的具体需求来设置.但有一点,那就是页面必须要控制图片的显示尺寸,否则就可能影响到页面的美观.如果 ...

  2. 根据屏幕大小动态设置字体rem

    //根据屏幕大小动态设置字体rem var docEl = document.documentElement,//当设备的方向变化(设备横向持或纵向持)此事件被触发.绑定此事件时,//注意现在当浏览器 ...

  3. android 动态让控件超出屏幕_android 动态设置屏幕控件宽高度

    获取屏幕宽高度: WindowManager wm = (WindowManager) context .getSystemService(Context.WINDOW_SERVICE); Displ ...

  4. el-table 根据屏幕大小动态设置max-height来自适应表格的最大高度出现滚动条

    根据element-ui的文档,max-height的合法的值为数字或者单位为 px 的高度.无法识别响应式的css,如: max-height:calc(100vh - 40px) //或者 max ...

  5. 用爬虫爬取某妹子图片网站图片

    闲聊 这部分在这就省了吧 感兴趣去我自己搭的博客看 : www.jojo-m.cn 代码实现 import requests from lxml import etree import time im ...

  6. html设置页面大小自动,H5 页面根据屏幕宽度自动设置 html 字体大小,适用 rem

    //designWidth:设计稿的实际宽度值,需要根据实际设置 //maxWidth:制作稿的最大宽度值,需要根据实际设置 //这段js的最后面有两个参数记得要设置,一个为设计稿实际宽度,一个为制作 ...

  7. 设置图片元素上下垂直居中的7种css样式_赵一鸣博客

    设置图片元素上下垂直居中的7种css样式 阅读(9548) @2018-07-15 14:13:34 图片.文字左右居中很简单,只需要以下代码: 1 text-align:center; 文字上下居中 ...

  8. 如何有效的避免图片侵权(100%避免网站图片侵权)

    最近发现很多站长都有收到法院的传票,主要是因为网站使用了对方的图片,对方要求索赔,小编也收到了这种侵权的官司,上下赔了1万多元,经过几次官司的经验,小编整合了一套方法,既可以随意使用图片,又可以避免吃 ...

  9. css 设置背景上面是图片,下面用纯颜色填充

    页面上面用一张背景图片,下面空白的地方 用其他纯颜色铺垫. css样式 #111111 用你需要的颜色代替 div{background: url(图片.png) no-repeat scroll t ...

最新文章

  1. RTMPdump(libRTMP) 源代码分析 3: AMF编码
  2. Community Server系列之九:CS2中的用户管理1(MemberRole)
  3. flume 1.7在windows下的安装与运行
  4. 防止IFRAME页被嵌套
  5. swift选择类或结构体
  6. 一行命令同时修改maven项目中多个mudule的版本号
  7. 2.WindowsServer2012R2装完的一些友好化设置
  8. 洛谷回文数c语言,【普及-】洛谷P1015:回文数 一种解法
  9. Studio启动的时候报错 Could not install Gradle distribution from
  10. Spring Boot自定义Banner
  11. 小程序 报request:fail invalid url 不校验合法域名已勾选
  12. 线性代数中一些有关秩的不等式
  13. ElasticSearch Java api 详解_V1.0
  14. c语言中反余切三角函数,三角函数(反双曲)正弦,余弦,正切,余切,正割,余割在线计算器_三贝计算网_23bei.com...
  15. 3097: Hash Killer I
  16. UVa10653.Prince and Princess
  17. android.scaler.streamConfigurationMap Key值的来源
  18. Ubuntu下使用OpenCV显示中文
  19. 隔离,隔离,再隔离!
  20. DeskMini310 黑苹果(hackintosh)

热门文章

  1. 简易博客搭建(html与css学习)(静态网页)
  2. 复制部分网页源代码到本地HTML文件,使用Python ==> pqQuery库 导入本地html文件,实现6行代码输出王者荣耀所有人物角色姓名
  3. ROS报错记录及解决方法
  4. iphone3g刷机_iPhone 3G S很热!
  5. 干货 | 电源PCB设计指南(含安规/EMC/布局/热设计/工艺)
  6. uniapp申请ios证书
  7. 概率生成函数(probability-generating function)
  8. 联通大换血,服务即将更好?
  9. 核心网技术之网络切片学习总结
  10. 数字能查出笔迹吗_十万火急!!跪求字迹达人帮忙辨认,这个数字是七还是一··...