c轉戰web,轉戰web

來源:互聯網
上載者:User

c轉戰web,轉戰web

運動連續:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js運動馬鈴薯</title>
<script src="move.js" type="text/javascript"></script>


</head>
<style>
*{
border:none;
margin:0;
padding:0;
}
a{
color:#FFF;
text-align:center;
text-decoration:none;
}
a:hover{
background:#906;
color:#FF0;
}
li{
list-style:none;
}
#div1{
display:none;
width:200px;
height:300px;
background:#000;
position:absolute;
bottom:-300px;
right:0;
}
#div2{
width:200px;
height:50px;
background:#090;
position:absolute;
bottom:0;
right:-200px;
}
#left{
height:139px;
width:34px;
float:left;
}
#left ul{
height:139px;
width:34px;
}
#left ul li{
width:34px;
height:26px;
margin-top:2px;
background:#000;
}
#weather{
background:#000;
width:160px;
height:280px;
margin-top:20px;
float:right;
}
#weather ul{
width:160px;
height:280px;
}
#weather ul .lei{
margin-top:10px;
height:60px;
background:#000;
}
.lei p{
position:relative;
top:15px;
display:block;
width:70px;
height:15px;
line-height:15px;
background:#FFF;
}
.lei img{
width:42px;
height:39px;
position:relative;
left:80px;
}
.lei em{
position:relative;
bottom:10px;
color:#0C0;
width:160px;
font-size:10px;
height:10px;
}
</style>
<script>
window.onload=function(){
var oBt=document.getElementById('obt');
var oDiv1=document.getElementById('div1');
var oDiv2=document.getElementById('div2');
oBt.onclick=function(){
startMove(oDiv2,'right',0,function(){
oDiv1.style.display='block';
startMove(oDiv1,'bottom',50);
})
}
}
</script>
<body>
<input type="button" value="運動" id="obt"  />
<div id="div1">
<div id="left">
<ul>
<li><a href="http://shop113745950.taobao.com/shop/view_shop.htm?spm=a1z0e.1.10010.4.UhaZJU">天氣</a></li>
<li><a  href="http://shop113745950.taobao.com/shop/view_shop.htm?spm=a1z0e.1.10010.4.UhaZJU">星座</a></li>
<li><a  href="http://shop113745950.taobao.com/shop/view_shop.htm?spm=a1z0e.1.10010.4.UhaZJU">熱點</a></li>
<li><a  href="http://shop113745950.taobao.com/shop/view_shop.htm?spm=a1z0e.1.10010.4.UhaZJU">排行</a></li>
<li><a  href="http://shop113745950.taobao.com/shop/view_shop.htm?spm=a1z0e.1.10010.4.UhaZJU">直播</a></li>
</ul>
</div>
<div id="weather">
<ul>
<p>駐馬店</p>
<li class="lei">
<p>今天周五</p>
<img src="01.gif" /><br>
<em>5-20度微風小於3級</em>
</li>
<li class="lei">
<p>明天</p>
<img src="02.gif" /><br>
<em>5-20度微風小於3級</em>
</li>
<li class="lei">
<p>後天</p>
<img src="01.gif" /><br>
<em>5-20度微風小於3級</em>
</li>
</ul>
</div>
</div>
<div id="div2"></div>
</body>

</html>

運動架構:

move.js

function getStyle(obj, name)
{
if(obj.currentStyle)
{
return obj.currentStyle[name];
}
else
{
return getComputedStyle(obj, false)[name];
}
}


function startMove(obj, attr, iTarget, fnEnd)
{
clearInterval(obj.timer);
obj.timer=setInterval(function (){
var cur=0;

if(attr=='opacity')
{
cur=Math.round(parseFloat(getStyle(obj, attr))*100);
}
else
{
cur=parseInt(getStyle(obj, attr));
}

var speed=(iTarget-cur)/6;
speed=speed>0?Math.ceil(speed):Math.floor(speed);

if(cur==iTarget)
{
clearInterval(obj.timer);

if(fnEnd)fnEnd();
}
else
{
if(attr=='opacity')
{
obj.style.filter='alpha(opacity:'+(cur+speed)+')';
obj.style.opacity=(cur+speed)/100;

document.getElementById('txt1').value=obj.style.opacity;
}
else
{
obj.style[attr]=cur+speed+'px';
}
}
}, 30);
}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.