課程
/前端開發(fā)
/JavaScript
/展開與收起效果
代碼輸入是一樣的,運(yùn)行不了,是不是沒有引入js文件的原因呢,如果是怎么引入呢
2018-07-30
源自:展開與收起效果 5-4
正在回答
代碼不一樣,方法判斷那里差遠(yuǎn)了,細(xì)心點(diǎn)吧
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>無解</title>
<style type="text/css">
* {
margin: 0 auto;
padding: 0;
}
#move {
width: auto;
height: 300px;
overflow: hidden;
background-color: hotpink;
.moke {
width: 1000px;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 20px;
background-color: orchid;
</style>
<script type="text/javascript">
var w = 0;
function addw() {
document.getElementById("move").style.width = w + "px";
if(w < 1000) {
w += 5;
setTimeout(addw, 30);
} else {
setTiomeout(subw, 5000);
window.onload = function() {
addw();
function subw() {
if(w > 0) {
w -= 5;
setTimeout(subw, 30);
document.getElementById("move").style.display = "none";
</script>
</head>
<body>
<div id="move">
<h1> 好好學(xué)習(xí)天天向上</h1>
</div>
<div class="moke">好喜歡學(xué)習(xí),才怪</div>
</body>
</html>
把你代碼貼上來
舉報(bào)
通過效果展示與案例分析,教您實(shí)現(xiàn)不同類型的展開與收起效果
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2018-08-15
代碼不一樣,方法判斷那里差遠(yuǎn)了,細(xì)心點(diǎn)吧
2018-08-06
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>無解</title>
<style type="text/css">
* {
margin: 0 auto;
padding: 0;
}
#move {
width: auto;
height: 300px;
overflow: hidden;
background-color: hotpink;
margin: 0 auto;
}
.moke {
width: 1000px;
height: 50px;
line-height: 50px;
text-align: center;
font-size: 20px;
background-color: orchid;
}
</style>
<script type="text/javascript">
var w = 0;
function addw() {
document.getElementById("move").style.width = w + "px";
if(w < 1000) {
w += 5;
setTimeout(addw, 30);
} else {
setTiomeout(subw, 5000);
}
}
window.onload = function() {
addw();
}
function subw() {
document.getElementById("move").style.width = w + "px";
if(w > 0) {
w -= 5;
setTimeout(subw, 30);
} else {
document.getElementById("move").style.display = "none";
}
}
</script>
</head>
<body>
<div id="move">
<h1> 好好學(xué)習(xí)天天向上</h1>
</div>
<div class="moke">好喜歡學(xué)習(xí),才怪</div>
</body>
</html>
2018-08-05
把你代碼貼上來