Page on both sides of the ad (mouse sensor) code effect

Source: Internet
Author: User
Couplet | The advertisement of couplet | The mouse | page

Click here to view the effect

Now a lot of website advertising to do in full swing, now I would like to introduce the common couplet floating advertising effect code use method, this article describes this effect, in the 1024*768 resolution of the normal display, in the resolution of the 800*600 can automatically hide, so as not to cover the page affect visitors browsing content, And unlike the previous code, when the mouse moved to the advertising picture can be induced to display another set of good advertising large image effect, the following text box is the desired code to achieve the effect:

function Bigshow () {
document.all.div_250.style.visibility = ' visible ';
document.all.div_80.style.visibility = ' hidden ';
}
function Bighide () {
document.all.div_80.style.visibility = ' visible ';
document.all.div_250.style.visibility = ' hidden ';
var ad_80= new Array (1);
var ad_250= new Array (1); ad_80[0]= "<a href=http://www.webjx.com target=_blank></a> ";
ad_250[0]= "<a href=http://www.webjx.com target=_blank></a> "; var imgheight;
var fubioleft;
Window.screen.width>800? Fubioleft=15:fubioleft=15document.write (' <div id=floater_left style= ' z-index:25; Left: ' +fubioleft+ ' px; width:28px; Position:absolute; top:42px; height:22px ">"); ad_now = new Date ();
Ad_id= ad_now.getseconds ()%1var adhead1= "<div id=div_80" style=; width:95px; height:62px; Z-index:12 ' Onmouseover=bigshow ();> ";
var adhead2= "</div><div id=div_250 style= ' Position:absolute;" Visibility:hidden; z-index:13;width:80; Height:60 ' Onmouseout=bighide ();> ";d ocument.write (adhead1+ad_80[ad_id]+adhead2+ad_250[ad_id]+" </div> ") ;d ocument.write ("</div>");
Self.onerror=null;
CurrentX = CurrentY = 0;
Whichit = null;
LASTSCROLLX = 0; lastscrolly = 0;
NS = (document.layers)? 1:0;
IE = (document.all)? 1:0;
function HeartBeat () {
if (IE) {
Diffy = Document.body.scrollTop;
DIFFX = Document.body.scrollLeft; }
if (NS) {
Diffy = Self.pageyoffset; DIFFX = Self.pagexoffset; }
if (Diffy!= lastscrolly) {
Percent =. 5 * (diffy-lastscrolly);
If (Percent > 0) percent = Math.ceil (percent);
else percent = Math.floor (percent);
if (IE) Document.all.floater_left.style.pixelTop + = percent;
if (NS) document.floater_left.top + = percent;
lastscrolly = lastscrolly + percent;
}
if (diffx!= lastscrollx) {
Percent =. 5 * (DIFFX-LASTSCROLLX);
If (Percent > 0) percent = Math.ceil (percent);
else percent = Math.floor (percent);
if (IE) Document.all.floater_left.style.pixelLeft + = percent;
if (NS) Document.floater_left.left + = percent;
LASTSCROLLX = lastscrollx + percent;
}
}

if (NS | | IE) action = Window.setinterval ("HeartBeat ()", 1); var ad_80= new Array (1);
var ad_250= new Array (1); ad_80[0]= "<a href=http://www.webjx.com target=_blank></a> ";
ad_250[0]= "<a href=http://www.webjx.com target=_blank></a> "; var imgheight;
var fubioleft;
Window.screen.width>800? Fubioleft=15:fubioleft=15document.write (' <div id=floater_right style= ' z-index:25; Left: ' +fubioleft+ ' px; width:28px; Position:absolute; top:42px; height:22px ">"); ad_now = new Date ();
Ad_id= ad_now.getseconds ()%1
function Myload ()
{
if (navigator.appname = "Netscape")
{
document.div_right_80.pagex=+window.innerwidth-130;
document.div_right_250.pagex=+window.innerwidth-300;
Mymove ();
}
Else
{
div_right_80.style.left=document.body.offsetwidth-130;
div_right_250.style.left=document.body.offsetwidth-300;
Mymove ();
}
}function Mymove ()
{
if (DOCUMENT.NS)
{
document.div_right_80.left=pagexoffset+window.innerwidth-130;
document.div_right_250.left=pagexoffset+window.innerwidth-300;
SetTimeout ("Mymove ();", 20)
}
Else
{
div_right_80.style.left=document.body.scrollleft+document.body.offsetwidth-145;
div_right_250.style.left=document.body.scrollleft+document.body.offsetwidth-300;
SetTimeout ("Mymove ();", 20)
}
var adhead1= "<div id=div_right_80 style= ' Position:absolute; width:95px; height:60px; Z-index:12 ' Onmouseover=bigshow_right ();> ";
var adhead2= "</div><div id=div_right_250 style= ' Position:absolute;" Visibility:hidden; z-index:13;width:250; height:250 ' Onmouseout=bighide_right (); ><div align=right> ";d ocument.write (adhead1+ad_80[ad_id]+adhead2+ ad_250[ad_id]+ "</div></div>"); Myload () document.write ("</div>");
Self.onerror=null;
Currentx_right = currenty_right = 0;
Whichit_right = null;
lastscrollx_right = 0; lastscrolly_right = 0;
NS = (document.layers)? 1:0;
IE = (document.all)? 1:0;
function Heartbeat_right () {
if (IE) {
Diffy_right = Document.body.scrollTop;
Diffx_right = Document.body.scrollLeft; }
if (NS) {
Diffy_right = Self.pageyoffset; Diffx_right = Self.pagexoffset; }
if (diffy_right!= lastscrolly_right) {
Percent_right =. 5 * (diffy_right-lastscrolly_right);
if (Percent_right > 0) percent_right = Math.ceil (percent_right);
else Percent_right = Math.floor (percent_right);
if (IE) Document.all.floater_right.style.pixelTop + = Percent_right;
if (NS) document.floater_right.top + = Percent_right;
Lastscrolly_right = Lastscrolly_right + percent_right;
}
if (diffx_right!= lastscrollx_right) {
Percent_right =. 5 * (diffx_right-lastscrollx_right);
if (Percent_right > 0) percent_right = Math.ceil (percent_right);
else Percent_right = Math.floor (percent_right);
if (IE) document.all.floater_right.style.pixelLeft + = Percent_right;
if (NS) document.floater_right.left + = Percent_right;
Lastscrollx_right = Lastscrollx_right + percent_right;
}
}

if (NS | | IE) action = Window.setinterval ("Heartbeat_right ()", 1);
function Bigshow_right () {
document.all.div_right_250.style.visibility = ' visible ';
document.all.div_right_80.style.visibility = ' hidden ';
}
function Bighide_right () {
document.all.div_right_80.style.visibility = ' visible ';
document.all.div_right_250.style.visibility = ' hidden ';
}document.write (");
document.write (");
document.write (");

Save the above code as a JS file, and then in the page you want to implement this effect, use <script type= "Text/javascript" language= "javascript1.2" src= "*.js" ></script > Call can, * on behalf of your saved file name! Pay attention to change the advertising picture address and connection address!



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.