Drop-down advertisement v1.2 on the top (New callback method)

Source: Internet
Author: User
AdTopDown (element_id, imgB_str, imgS_str, {[imgTargetURL], [duration], [delay], [backFn], [isAnimation]}) parameter description: element_id: element Node before advertisement imgB_str: Ad large image imgS_str: Ad small image optional parameter

AdTopDown (element_id, imgB_str, imgS_str, {[imgTargetURL], [duration], [delay], [backFn], [isAnimation]})
Parameter description:
Element_id: Element Node before the advertisement
ImgB_str: large ad Image
ImgS_str: small advertisement Image
Optional parameters:
ImgTargetURL: link address
Duration: animation speed
Delay: stay time
BackFn: callback method after the animation is completed (added in v1.2)
IsAnimation: whether to play an animation (true/false)
Usage:

New AdTopDown ('page', "images/ad/quming_banner_ B .jpg", "images/ad/quming_banner_s.jpg ")
You can also use the following animation effects:

New AdTopDown ('page', "images/ad/quming_banner_ B .jpg", "images/ad/quming_banner_s.jpg ",{
ImgTargetURL: "/quming_index.jspx? Topad ",
BackFn: function (obj ){
Alert ('after the animation is played, I will be output ');
}
});
The following static effect usage:

New AdTopDown ('page', "images/ad/quming_banner_ B .jpg", "images/ad/quming_banner_s.jpg", {isAnimation: false });
 
The Code is as follows:

/*
* Top drop-down animation advertisement v 1.2 by: dum 2012-03-16
* Element_id: imgB_str \ imgS_str: Ad Image
* Added the callback method backFn.
*/
Var AdTopDown = Class. create ();
AdTopDown. prototype = {
Initialize: function (element_id, imgB_str, imgS_str) {// Constructor
This. elementObj = $ (element_id );
This. imgB_str = imgB_str;
This. options = Object. extend ({
ImgTargetURL: "#", // URL
Duration: 1.2, // animation speed
Delay: 1.0, // stay time
BackFn: function (obj) {}, // callback method after animation is completed
IsAnimation: true // whether to play the animation
}, Arguments [3] || {});
This. scale_str = ""
+ ""
+ ""
This. blindDown_str = ""
+ ""
+ ""

If (this. options. isAnimation ){
This. animation ();
} Else {
This. statics ();
}
},
Animation: function () {// animation display www.2cto.com
New Insertion. After (this. elementObj, this. scale_str );
New Insertion. After ($ ('ad _ index_Scale '), this. blindDown_str );
This. animation_Scale ();
},
Animation_Scale: function (){
New Effect. Scale ('ad _ index_Scale ', 0 ,{
ScaleX: false,
ScaleY: true,
Duration: this. options. duration,
Delay: this. options. delay,
AfterFinishInternal: this. animation_blindown.bind (this)
});
},
Animation_blindown: function (obj ){
New Effect. blindown ('ad _ index_blindown ',{
ScaleX: false,
ScaleY: true,
AfterFinishInternal: this. options. backFn. bind (this)
});
},
Statics: function () {// static display
New Insertion. After (this. elementObj, this. blindDown_str );
$ ('Ad _ index_blinkdown '). setStyle ({marginTop: '10px '});
$ ('Ad _ index_blinkdown '). show ();
}
};
 
Css used

. Ad_index_Scale,. ad_index_BlindDown {width: 980px; margin: 0 auto; clear: both; overflow: hidden ;}
. Ad_index_Scale {margin-top: 10px ;}

 

From renwumao.com (Task cat)
 
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.