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

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

不是上不去就是沒有暫停時間,哪里出問題了?

在火狐里上不去一直抖,????Safari里就沒有暫停時間直接上去了。不知道哪里出問題了。<!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>自動展開</title>
??? <style type="text/css">
??????? body
??????? {
??????????? margin: 0 auto;
??????????? padding: 0;
??????? }
??????? a:focus
??????? {
??????????? outline: none;
??????? }
?????? ?
??????? #pn
??????? {
??????????? background: #e8e8e8;
??????????? height: 120px;
??????????? width: auto;
??????????? display: block;
??????????? margin: 0 auto;
??????????? padding: 5px;
??????????? text-align: center;
??????????? overflow:hidden;
??????? }
??????? .slide
??????? {
??????????? padding: 10px;
??????????? width: 960px;
??????????? margin: 0 auto;
??????????? background: gray;
??????????? text-align: center;
??????????? height: 40px;
??????????? line-height: 40px;
??????????? color: #fff;
??????? }
??? </style>
??? <script type="text/javascript">
?????? var h= 0;
????? ?
??????? //增加高度函數(shù)addH()
?????????? ?
??????? function addh() { ?
?????????? if(h < 300){
?????????????? h += 2;
???????????? document.getElementById("pn").style.height = h + "px";
?????????? }
?? ??? ???? else{
?? ??? ????? return ; ?
?? ??? ???? }
??????????? setTimeout("addh()",30);
??????? }
?????? ?
?????? //網(wǎng)頁加載完畢時,調(diào)用增加高度函數(shù)addH(),等待5秒鐘后調(diào)用減少高度函數(shù)subh()。
??????? window.onload = function(){
??????????? addh();
??????????? setTimeout("subh()",5000);
??????? }
???? ?
???? ?
????? // 減少高度函數(shù)subH()
?? ?
??????? function subh() {
?????????? if(h > 0){
?????????????? h -= 2;
???????????? document.getElementById("pn").style.height = h + "px";
?????????? }
?? ??? ???? else{
?? ??? ????? return? ;
?? ??? ???? }
??????????? setTimeout("subh()",30);
??????? }
??????? ?
?????????? ?
?????????? ?
?????????? ?
??? </script>
</head>
<body>
??? <div id="pn">
??????? <h1>
??????????? 歡迎來到慕課網(wǎng)</h1>
??????? <h2>
??????????? 大幅廣告</h2>
??? </div>
??? <p class="slide">
??????? 慕課網(wǎng)歡迎你</p>
</body>
</html>

正在回答

3 回答

function subh() {
?????????? if(h > 0){
?????????????? h -= 2;
???????????? document.getElementById("pn").style.height = h + "px";?
?????????? }
?? ??? ???? else{
?? ??? ????? return? ;?
?? ??? ???? }
??????????? setTimeout("subh()",30);
??????? }


? h -= 2改成? h -= 5就沒問題了

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

你的速度設(shè)置有問題,當文檔加載完畢后,高度真的成300px了嗎?顯然不是,是192px,所以解決方案有2;其一是改變速度的變化值;其二是延遲文檔加載完畢后的時間去執(zhí)行subh函數(shù)

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

沒問題啊。

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

舉報

0/150
提交
取消
展開與收起效果
  • 參與學習       33632    人
  • 解答問題       187    個

通過效果展示與案例分析,教您實現(xiàn)不同類型的展開與收起效果

進入課程

不是上不去就是沒有暫停時間,哪里出問題了?

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

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

幫助反饋 APP下載

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

公眾號

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