日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

钢琴快案例及手风琴案例

發(fā)布時(shí)間:2025/3/14 50 豆豆
生活随笔 收集整理的這篇文章主要介紹了 钢琴快案例及手风琴案例 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

//鋼琴快案例

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
#ha{
width:600px;
height:200px;
border:red 1px solid;
margin:100px auto;
position:relative;
}
#ha>span{
width:50px;
height:40px;
background:#369;
display:inline-block;
position:absolute;
bottom:0;
transition:all 500ms linear;
}
</style>
</head>
<body>
<div id="ha">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</body>
</html>
<script>
var ha=document.getElementById("ha");
spans=ha.getElementsByTagName("span");
for(var o=0;o<spans.length;o++){
spans[o].style.left=80*o+"px";
}
document.οnkeydοwn=function(ev){
var ev=ev||window.event;
var code=ev.keyCode-49;
if(code<0||code>6){
rest(spans)
}
else{
rest(spans)
spans[code].style.height=100+"px";

console.log(code)
}

}
function rest(spans){
for(var j=0;j<spans.length;j++){
spans[j].style.height="";
}
}
</script>

//手風(fēng)琴案例

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
#ha{
width:725px;
height:240px;
border:red 1px solid;
margin:100px auto;
position:relative;
overflow:hidden;
}
#ha img{
position:absolute;
}
</style>
</head>
<body>
<div id="ha">
<img src="img/妹1.jpg" />
<img src="img/妹2.jpg"/>
<img src="img/張慧雯.jpg"/>
<img src="img/柳巖.jpg"/>
</div>
</body>
</html>
<script>
var ha=document.getElementById("ha");
var imgs=ha.getElementsByTagName("img");
var num=425;
var t=null;
var um=0;
function fn(){
for(var i=1;i<imgs.length;i++){
imgs[i].style.left=num+100*(i-1)+"px";
}
}
fn()
for(var i=0;i<imgs.length;i++){
~function(i){
imgs[i].οnmοuseοver=function(){
fn()
for(var j=1;j<=i;j++){
imgs[j].style.left=100*j+"px";
}
um=i;
}
}(i)
}
ha.οnmοuseοver=function(){
clearInterval(t)
}
ha.οnmοuseοut=function(){
t=setInterval(function(){
bn()
},1000)
}

t=setInterval(function(){
bn()
},1000)
function bn(){
um++
if(um>imgs.length-1){
um=0;
fn()
}
imgs[um].style.left=100*um+"px";
imgs[um].style.transition="all 500ms linear";
}
</script>

轉(zhuǎn)載于:https://www.cnblogs.com/shangjun6/p/10375287.html

總結(jié)

以上是生活随笔為你收集整理的钢琴快案例及手风琴案例的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。