After implementing jquery triggering an event, stay for 5 seconds, and then trigger the following event

Source: Internet
Author: User

Here is an ad bit of jquery code, there are two different ad bits, one is floating in the middle, the display automatically disappears after 5 seconds, and only once per day (cookie implementation):

//the js===================== of ===================== ad bit$ (document). Ready (function(){    //AD Center floating 5 seconds after auto-disappear or click to close$ ("#bannerFloatCenter"). CSS ("left", ($ (document). Width ()-250)/2);//depending on the cookie, decide if you want to display the center area ad:    if(!Issetcookie ()) {        $("#bannerFloatCenter"). FadeIn (2000,function() {window.settimeout (' $ ("#bannerFloatCenter"). Slideup (1000); ', 5000);        }); $("#bannerFloatCenter span"). Click (function(){            $("#bannerFloatCenter"). Slideup (1000);    }); }                //the right column of the ad bit floats with the scroll bar scroll up and down, you can click Close to disappear$ (window). Scroll (function() {        varOffsetTop = + $ (window). scrolltop () + "px"; $("#bannerFloatFlowScroll"). Animate ({top:offsettop}, {duration:300, queue:false })    }); $("#bannerFloatFlowScroll span"). Click (function(){        $("#bannerFloatFlowScroll"). Slideup (); });});

Here is a DIV for two ad positions:

 <!--ad Center floats after 5 seconds to disappear automatically or click Close disappears-<div id= "Bannerfloatcenter" style= "Position:absolute;z-index:2;left : 483px; top:275px; border: #9DCE63 4px solid; Display:none; " > <a href= "http://www.cntronics.com/public/lecture/list?cid=7" >baseurl ();? >/images/semiwelcomebanner_250.jpg "/></a> <span title=" Close "style=" position:absolute; cursor:pointer;left:213px;top:-17px;font-size:12px; " >[Close]</span> </div> <!--the right column of the ad bit moves up and down with the scroll bar scrolling, you can click Close disappears--<div id= "Bannerfloatflowscroll" Style= "Position:absolute; Z-index:2; right:50px;top:133px; " > <a href= "http://www.cntronics.com/public/whitepaper/index/sp/22" >baseurl ();? >/images/semisidebanner_120.jpg "/></a> <span title=" Close "style=" position:absolute; cursor:pointer;left:80px;top:-14px;font-size:12px; " >[close]</span> </div> 

Another way to do this is to put the settimeout () function out:

<script language= "JavaScript" >    function  reloadnewquestion () {        //  jquery code        var no = math.random ();         var url = "<?php echo $this->baseurl ();? >/webinar/index/newquestion/no/"+no;        $ (". Content.content_1 ul"). Load (URL);        SetTimeout ("reloadnewquestion ()", 60000);    } </script><script language= "JavaScript" >    $ (document). Ready () {        reloadnewquestion ();    } </script>

After implementing jquery triggering an event, stay for 5 seconds, and then trigger the following event

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.