js,滚动条左侧可用调色板选择条纹颜色 效果图: 代码如下: <!doctype html><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> 以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持wanshiok.com! js,滚动条
|