Web page couplet advertisement code effect Daquan

Source: Internet
Author: User
Keywords Web page production Ajax javascript
Tags advertising advertising effect ajax code content display function javascript

Now a lot of website advertising to do in full swing, now I would like to introduce the common couplet floating advertising effect of the code use method, introduced this effect, in the 1024x768 resolution of the normal display, in the 800x600 resolution can automatically hide, so as not to cover the page affect visitors browsing content, Here is the code needed to implement the effect:


  var delta=0.015
    var collection
    function floaters () {
        this.items    = [];
        this.additem    = function (id,x,y,content)
                  {
                     document.write (' <div id= ' +id+ ' style= ' z-index:0; position:absolute;  width:80px; Height:60px;left: ' + (typeof (x) = = ' string '? Eval (x): x) + '; Top: ' + (typeof (y) = = ' string '? Eval (y): y) + ' "> ' +content+ ' </DIV> ');
                   
                     var newitem                = {};
                     newitem.object            = document.getElementById (ID);
                     newitem.x                 = x;
                     newitem.y                 = y;

This.items[this.items.length] = NewItem;


                  }


This.play = function ()


                  {


collection = This.items


setinterval (' Play () ', 10);


}


        }


function Play ()


        {


if (screen.width&lt;=800)


            {


for (var i=0;i&lt;collection.length;i++)


                {


collection[i].object.style.display = ' none ';


}


return;


            }


for (var i=0;i&lt;collection.length;i++)


            {


var followobj = collection[i].object;


var followobj_x = (typeof (collection[i].x) = = ' String ' eval (collection[i].x): collection[i].x);


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var followobj_y&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = (typeof (collection[i].y) = = ' String ' eval (collection[i].y): COLLECTION[I].Y) ;

Related Article

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.