Demo code:
If you need to introduce external Js, you need to refresh to execute it
]
The code is as follows:
$(function(){
//The height of the title layer --Prompt to turn on or off
var titHeight=$("#ditTitle").height();
//The height of the content layer
var conHeight=$("#divContent").height() ;
//Open or close
$("#close").toggle(function(){
//Change the prompt
$("#close").text(" Close");
//Animation--the height of the message layer increases within one second, and the top increases
$("#msgDiv").animate({height:titHeight conHeight},1000,function(){
//Function executed after expansion
});
}, function(){
//Change prompt
$("#close").text("Open");
//alert(temp " " titHeight);
$("#msgDiv").animate({height:titHeight},1000,function(){
//Function executed after closing
} );
})
//Execute
var myTimer,i=8;
function starFun()
{
//Trigger click event and display
if(i==4)
{
$("#close").click();
}
//Clear timeout, trigger click event, close layer
if(i ==0)
{
window.clearTimeout(myTimer);
if($("#close").text()!="Open")
$("#close") .click();
}
myTimer=window.setTimeout(starFun,1000);
i=i-1;
}
starFun()
});
It has been tested that IE6 does not run. In view of the fact that there are currently many Chinese users using IE6, it is recommended that you learn it, but it is not recommended to use it.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn