最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
js实现彩色条纹滚动条效果
时间:2017-06-29 编辑:简简单单 来源:一聚教程网
左侧可用调色板选择条纹颜色
效果图:
代码如下:
代码如下 | 复制代码 |
< html > < head > < meta charset = "utf-8" > < title > title > < style > *{margin:0; padding:0;} @-webkit-keyframes demo{ from{ left:0;} to{ left:-113px;} } .box{ width:120px; height:400px; border:1px solid #000; margin:100px auto; position:relative; overflow:hidden;} .bar{ position:absolute; left:0; top:0; width:500px; height:400px; background: -webkit-repeating-linear-gradient(-45deg , red 0px, red 20px, #fff 20px, #fff 40px, blue 40px, blue 60px, #fff 60px, #fff 80px); animation:demo 2s linear infinite; }
style > < script > window.onload = function(){ var oC1 = document.querySelectorAll('input')[0]; var oC2 = document.querySelectorAll('input')[1]; var oBar = document.querySelector('.box .bar'); oC1.onchange = oC2.onchange = function(){ oBar.style.background = '-webkit-repeating-linear-gradient(-45deg , '+oC1.value+' 0px, '+oC1.value+' 20px, #fff 20px, #fff 40px, '+oC2.value+' 40px, '+oC2.value+' 60px, #fff 60px, #fff 80px)'; }; };
script >
head > < body > < input type = "color" value = "#ff0000" /> < input type = "color" value = "#0000ff" /> < div class = "box" > < div class = "bar" > div >
div >
body >
html > |
-
上一个: jQuery阻止移动端遮罩层后页面滚动
-
下一个: jQuery实现移动端Tab选项卡效果
相关文章
- js实现4个方向滚动的球 05-28
- js实现无缝滚动图 04-24
- JS实现的DIV块来回滚动效果示例 03-17
- js实现文本上下来回滚动的教程 03-13
- 原生js实现中奖信息无间隙滚动效果 02-06
- js实现消息滚动效果的教程 02-06