第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

我的跟老師寫的一樣,但是沒有變大的效果,怎么回事?

? ? <style>

? ? ? ? * { margin:0px; padding:0px;}

? ? ? ? .top { width:200px; overflow:hidden; float:left;}

? ? ? ? .top ul {width:200px; overflow:hidden; float:left; }

? ? ? ? .top ul li { width:200px; height:100px; background:#ffd800; float:left; margin-bottom:20px;}

? ? </style>

<script>

? ? window.onload = function () {

? ? ? ??

? ? ? ? var count = document.getElementsByTagName("li");


? ? ? ? for (var i = 0; i < count.length; i++) {

? ? ? ? ? ? count[i].onmouseover = function () {

? ? ? ? ? ? ? ? startMove(this, 400);

? ? ? ? ? ? }

? ? ? ? ? ? count[i].onmouseout = function () {

? ? ? ? ? ? ? ? startMove(this, 200);

? ? ? ? ? ? }

? ? ? ? }

? ? }


? ? var time = null;

? ? function startMove(obj, end) {


? ? ? ? clearInterval(time);

? ? ? ? time = setInterval(function () {


? ? ? ? ? ? var speed = (end - obj.offsetWidth) / 8;

? ? ? ? ? ? speed = speed > 0 ? Math.ceil(speed) : Math.floor(speed);

? ? ? ? ? ? if (obj.offsetWidth == end) {

? ? ? ? ? ? ? ? clearInterval(time);

? ? ? ? ? ? } else {

? ? ? ? ? ? ? ? obj.style.width = obj.offsetWidth + speed + 'px';

? ? ? ? ? ? }


? ? ? ? }, 30)

? ? }

</script>

<body>

<div class="top" id="top">

? ? <ul>

? ? ? ?<li></li>

? ? ? ?<li></li>

? ? ? ?<li></li>

? ? </ul>

</div>

哪位小伙伴能幫我看看,非常感謝

正在回答

3 回答

這個代碼的完整答案是這樣的

<!DOCTYPE?html>
<html>
<head>
<meta?charset="UTF-8">
<title>demo</title>
<style?type="text/css">
*{margin:?0;padding:?0;}
ul{list-style-type:?none;}
ul?li{width:?200px;height:?100px;background:?yellow;margin-bottom:?20px;}
</style>
<script?type="text/javascript">
window.onload?=?function(){
var?oLi?=?document.getElementsByTagName('li');
for(var?i?=?0?;?i?<?oLi.length?;?i++){
oLi[i].timer?=?null;
oLi[i].onmouseover?=?function(){
starMove(this,400);
}
oLi[i].onmouseout?=?function(){
starMove(this,200);
}
}
}
function?starMove(obj,iTarget){
clearInterval(obj.timer);
obj.timer?=?setInterval(function(){
var?speed?=?(iTarget?-?obj.offsetWidth)/5;
speed=speed>0???Math.ceil(speed):Math.floor(speed);?
if?(obj.offsetWidth?==?iTarget)?{
clearInterval(obj.timer);
}else{
obj.style.width?=?obj.offsetWidth?+?speed?+?"px";
}
},30)
}
</script>
</head>
<body>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>


0 回復 有任何疑惑可以回復我~

非常感謝!我寫的時候div定死了寬度,所以li就不會變大

0 回復 有任何疑惑可以回復我~
#1

Aurora丶

。。。注意細節(jié)
2015-11-02 回復 有任何疑惑可以回復我~

代碼測試了完全沒有問題阿?

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

我的跟老師寫的一樣,但是沒有變大的效果,怎么回事?

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號