mescroll.css 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. /*! mescroll -- 精致的下拉刷新和上拉加载js框架 ( a great JS framework for pull-refresh and pull-up-loading )
  2. * version 1.3.8
  3. * 2018-09-29
  4. * author: wenju < mescroll@qq.com > 文举
  5. * *
  6. * 官网: http://www.mescroll.com
  7. * 动态: https://github.com/mescroll/mescroll/releases
  8. * 问答: http://www.mescroll.com/qa.html
  9. * issues: https://github.com/mescroll/mescroll/issues
  10. * QQ交流群: 633126761
  11. *
  12. * 温馨提示: mescroll唯一的全局样式: html,body{height:100%},用于固定body的高度满屏; 如果影响到您原本的项目样式,可自行删除
  13. *
  14. *
  15. * ----- mescroll的html结构解析 ----
  16. *
  17. <body>
  18. <div id="mescroll" class="mescroll">
  19. <div>
  20. //下拉刷新区域 ( mescroll初始化之后自动创建 )
  21. <div class="mescroll-downwarp">
  22. <div class="downwarp-content">
  23. <p class="downwarp-progress"></p> <p class="downwarp-tip">下拉刷新 </p>
  24. </div>
  25. </div>
  26. //界面的具体内容
  27. //<div>界面内容</div>
  28. //数据列表..
  29. //<ul id="dataList" class="data-list">
  30. // <li>数据列表</li>
  31. //空布局 ( 列表无任何数据时, 且配置了warpId时, 会自动创建显示 )
  32. <div class="mescroll-empty">
  33. <img class="empty-icon" src="../img/mescroll-empty.png"/>
  34. <p class="empty-tip">暂无相关数据~</p>
  35. <p class="empty-btn">去逛逛 ></p>
  36. </div>
  37. //</ul>
  38. //上拉加载区域 ( mescroll初始化之后自动创建 )
  39. <div class="mescroll-upwarp">
  40. //加载中..
  41. <p class="upwarp-progress mescroll-rotate"></p><p class="upwarp-tip">加载中..</p>
  42. //无数据
  43. <p class="upwarp-nodata">-- END --</p>
  44. </div>
  45. </div>
  46. </div>
  47. //回到顶部按钮 ( 列表滚动到配置的距离时, 且配置了warpId时, 会自动创建显示, 注意是添加在body中的 )
  48. <img class="mescroll-totop" src="../img/mescroll-totop.png"/>
  49. </body>
  50. *
  51. */
  52. /*设置body的高度,以便正确的获取body高度和触发scroll事件*/
  53. html,
  54. body {
  55. height: 100%;
  56. }
  57. /*使iOS列表滑动流畅*/
  58. body {
  59. -webkit-overflow-scrolling: touch;
  60. }
  61. /*下拉刷新和上拉加载的滑动区域*/
  62. .mescroll {
  63. width: 100%;
  64. height: 100%;
  65. overflow-y: auto;
  66. }
  67. /*启用硬件加速:使动画渲染流畅,解决部分手机闪白屏问题,在下拉刷新和上拉加载触发时启用,结束后移除,避免滥用导致其他兼容性问题*/
  68. .mescroll-hardware {
  69. -webkit-transform: translateZ(0);
  70. -webkit-transform-style: preserve-3d;
  71. -webkit-backface-visibility: hidden;
  72. -webkit-perspective: 1000;
  73. }
  74. /*下拉刷新区域*/
  75. .mescroll-downwarp {
  76. position: relative;
  77. width: 100%;
  78. height: 0;
  79. overflow: hidden;
  80. text-align: center;
  81. }
  82. /*下拉刷新--高度重置的过渡动画*/
  83. .mescroll-downwarp-reset {
  84. -webkit-transition: height 300ms;
  85. transition: height 300ms;
  86. }
  87. /*下拉刷新--内容区,定位于区域底部*/
  88. .mescroll-downwarp .downwarp-content {
  89. position: absolute;
  90. left: 0;
  91. bottom: 0;
  92. width: 100%;
  93. min-height: 30px;
  94. padding: 10px 0;
  95. }
  96. /*上拉加载区域*/
  97. .mescroll-upwarp {
  98. min-height: 30px;
  99. padding: 15px 0;
  100. text-align: center;
  101. visibility: hidden;/*代替display: none,列表快速滑动到底部能及时显示上拉加载的区域*/
  102. }
  103. /*下拉刷新,上拉加载--提示文本*/
  104. .mescroll-downwarp .downwarp-tip,
  105. .mescroll-upwarp .upwarp-tip,
  106. .mescroll-upwarp .upwarp-nodata {
  107. display: inline-block;
  108. font-size: 12px;
  109. color: gray;
  110. vertical-align: middle;
  111. }
  112. .mescroll-downwarp .downwarp-tip,
  113. .mescroll-upwarp .upwarp-tip{
  114. margin-left: 8px;
  115. }
  116. /*下拉刷新,上拉加载--旋转进度条*/
  117. .mescroll-downwarp .downwarp-progress,
  118. .mescroll-upwarp .upwarp-progress {
  119. display: inline-block;
  120. width: 16px;
  121. height: 16px;
  122. border-radius: 50%;
  123. border: 1px solid gray;
  124. border-bottom-color: transparent;
  125. vertical-align: middle;
  126. }
  127. /*旋转动画*/
  128. .mescroll-rotate {
  129. -webkit-animation: mescrollRotate 0.6s linear infinite;
  130. animation: mescrollRotate 0.6s linear infinite;
  131. }
  132. @-webkit-keyframes mescrollRotate {
  133. 0% {
  134. -webkit-transform: rotate(0deg);
  135. }
  136. 100% {
  137. -webkit-transform: rotate(360deg);
  138. }
  139. }
  140. @keyframes mescrollRotate {
  141. 0% {
  142. transform: rotate(0deg);
  143. }
  144. 100% {
  145. transform: rotate(360deg);
  146. }
  147. }
  148. /*无任何数据的空布局*/
  149. .mescroll-empty {
  150. width: 100%;
  151. padding-top: 20px;
  152. text-align: center;
  153. }
  154. .mescroll-empty .empty-icon {
  155. width: 45%;
  156. }
  157. .mescroll-empty .empty-tip {
  158. margin-top: 6px;
  159. font-size: 14px;
  160. color: gray;
  161. }
  162. .mescroll-empty .empty-btn {
  163. max-width: 50%;
  164. margin: 20px auto;
  165. padding: 10px;
  166. border: 1px solid #65AADD;
  167. border-radius: 6px;
  168. background-color: white;
  169. color: #65AADD;
  170. }
  171. .mescroll-empty .empty-btn:active {
  172. opacity: .75;
  173. }
  174. /*回到顶部的按钮*/
  175. .mescroll-totop {
  176. z-index: 9990;
  177. position: fixed;
  178. right: 10px;
  179. bottom: 30px;
  180. width: 36px;
  181. height: 36px;
  182. border-radius: 50%;
  183. opacity: 0;
  184. }
  185. /*显示动画--淡入*/
  186. .mescroll-lazy-in,
  187. .mescroll-fade-in {
  188. -webkit-animation: mescrollFadeIn .5s linear forwards;
  189. animation: mescrollFadeIn .5s linear forwards;
  190. }
  191. @-webkit-keyframes mescrollFadeIn {
  192. 0% {
  193. opacity: 0;
  194. }
  195. 100% {
  196. opacity: 1;
  197. }
  198. }
  199. @keyframes mescrollFadeIn {
  200. 0% {
  201. opacity: 0;
  202. }
  203. 100% {
  204. opacity: 1;
  205. }
  206. }
  207. /*隐藏动画--淡出*/
  208. .mescroll-fade-out {
  209. pointer-events: none;
  210. -webkit-animation: mescrollFadeOut .5s linear forwards;
  211. animation: mescrollFadeOut .5s linear forwards;
  212. }
  213. @-webkit-keyframes mescrollFadeOut {
  214. 0% {
  215. opacity: 1;
  216. }
  217. 100% {
  218. opacity: 0;
  219. }
  220. }
  221. @keyframes mescrollFadeOut {
  222. 0% {
  223. opacity: 1;
  224. }
  225. 100% {
  226. opacity: 0;
  227. }
  228. }
  229. /*滚动条轨道背景(默认在PC端设置)*/
  230. .mescroll-bar::-webkit-scrollbar-track {
  231. background-color: transparent;
  232. }
  233. /*滚动条轨道宽度 (默认在PC端设置)*/
  234. .mescroll-bar::-webkit-scrollbar {
  235. width: 6px;
  236. }
  237. /*滚动条游标 (默认在PC端设置)*/
  238. .mescroll-bar::-webkit-scrollbar-thumb {
  239. border-radius: 6px;
  240. background-color: #ccc;
  241. }
  242. /*滚动条游标鼠标经过的颜色变化 (默认在PC端设置)*/
  243. .mescroll-bar::-webkit-scrollbar-thumb:hover {
  244. background-color: #aaa;
  245. }