博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
css隐藏自带的滚动轴,兼容IE,FF,Webkit 和 O
阅读量:3948 次
发布时间:2019-05-24

本文共 1737 字,大约阅读时间需要 5 分钟。

第一种

::-webkit-scrollbar {        display: none;    }

缺点:不通用,兼容性差。IE不兼容

第二种

/*webkit内核*/::-webkit-scrollbar {    width:0px;    height:0px;}::-webkit-scrollbar-button    {    background-color:rgba(0,0,0,0);}::-webkit-scrollbar-track     {    background-color:rgba(0,0,0,0);}::-webkit-scrollbar-track-piece {    background-color:rgba(0,0,0,0);}::-webkit-scrollbar-thumb{    background-color:rgba(0,0,0,0);}::-webkit-scrollbar-corner {    background-color:rgba(0,0,0,0);}::-webkit-scrollbar-resizer  {    background-color:rgba(0,0,0,0);}/*o内核*/.-o-scrollbar{    -moz-appearance: none !important;       background: rgba(0,255,0,0) !important;  }::-o-scrollbar-button    {    background-color:rgba(0,0,0,0);}::-o-scrollbar-track     {    background-color:rgba(0,0,0,0);}::-o-scrollbar-track-piece {    background-color:rgba(0,0,0,0);}::-o-scrollbar-thumb{    background-color:rgba(0,0,0,0);}::-o-scrollbar-corner {    background-color:rgba(0,0,0,0);}::-o-scrollbar-resizer  {    background-color:rgba(0,0,0,0);}/*IE10,IE11,IE12*/.box1{    -ms-scroll-chaining: chained;    -ms-overflow-style: none;    -ms-content-zooming: zoom;    -ms-scroll-rails: none;    -ms-content-zoom-limit-min: 100%;    -ms-content-zoom-limit-max: 500%;    -ms-scroll-snap-type: proximity;    -ms-scroll-snap-points-x: snapList(100%, 200%, 300%, 400%, 500%);    -ms-overflow-style: none;    overflow: auto;}$(function(){    //FF下用JS实现自定义滚动条    $(".box1").niceScroll({cursorborder:"",cursorcolor:"rgba(0,0,0,0)",boxzoom:true});})

参数说明:

  1. ::-webkit-scrollbar 滚动条整体部分,可以设置宽度等
  2. ::-webkit-scrollbar-button 滚动条两端的按钮
  3. ::-webkit-scrollbar-track  外层轨道
  4. ::-webkit-scrollbar-track-piece  内层滚动槽
  5. ::-webkit-scrollbar-thumb 滚动的滑块
  6. ::-webkit-scrollbar-corner 边角
  7. ::-webkit-resizer 定义右下角拖动块的样式

               

转载地址:http://jchwi.baihongyu.com/

你可能感兴趣的文章
Js或jQuery图片层叠轮播------Sestid
查看>>
js或jQuery实现返回顶部功能------Sestid
查看>>
JS实现拖拽效果------Sestid
查看>>
jQuery实现倒计时秒杀效果------Sestid
查看>>
jQuery实现html网页顶部自适应导航栏(media)------Sestid
查看>>
鼠标悬停显示下划线(带小特效)------Sestid
查看>>
jQuery 实现input搜索框自动匹配------Sestid
查看>>
Js 实现回车键触发登录,并弹出需要输入信息------Sestid
查看>>
Js字符串和数组方法及使用------Sestid
查看>>
JavaScript常用算法(面试)------Sestid
查看>>
Js或者jQuery实现点击图片出现蒙层并将图片放大在蒙层上------Sestid
查看>>
Js,jQuery事件、效果大全------Sestid
查看>>
CSS块元素、内联元素、内联块元素详解------Sestid
查看>>
Js实现跟随鼠标移动的小球------Sestid
查看>>
HTML图像,链接,列表,表格等详细介绍------Sestid
查看>>
Js实现的俄罗斯方块小游戏------Sestid
查看>>
Js实现贪吃蛇小游戏------Sestid
查看>>
jQuery常用方法(持续更新)
查看>>
原生js实现自定义倒计时效果------Sestid
查看>>
原生js实现生成随机验证码=------Sestid
查看>>