Home > Web Front-end > JS Tutorial > Pop-up ads in the lower right corner of web pages based on jQuery (IE7, firefox)_jquery

Pop-up ads in the lower right corner of web pages based on jQuery (IE7, firefox)_jquery

WBOY
Release: 2016-05-16 18:20:52
Original
974 people have browsed it

Demo code:


[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute it
]
Core code: Copy code
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.
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template