Implementation Code of regular display and hide div advertisement Based on jquery

Source: Internet
Author: User

Below I will share with you my methods:

In jquery, it is easy to use the hide and show methods directly to display and hide layers, but we need to use the setTimeout function for the instance at a scheduled time, I will share with you my methods below.
In the html page, we can just put something.

Copy codeThe Code is as follows: <div class = "toolbarframe" style = "display: none; "> <a href =" http://www.jb51.net "target =" _ blank "> </a> <a class =" bigad_close "> close </a> </div>

Jquery code

Copy codeThe Code is as follows:
<Script src = "/js/jquery-1.7.2.min.js" language = "javascript" type = "text/javascript"> </script>
<Script>
$ (Function (){
SetTimeout ('$ (". toolbarframe"). show ("slow")', 3000 );
SetTimeout ('$ (". toolbarframe"). hide ("slow")', 13000 );
$ (". Bigad_close"). click (function (){
$ (". Toolbarframe"). hide ("slow ");
})
});
</Script>

Briefly introduce the above core implementation code:

Copy codeThe Code is as follows:
SetTimeout ('$ (". toolbarframe"). show ("slow")', 3000); after three seconds, the div is displayed from small to large.
SetTimeout ('$ (". toolbarframe"). hide ("slow")', 13000); automatically hides the div from large to small in 10 seconds.
$ (". Bigad_close"). click (function (){
$ (". Toolbarframe"). hide ("slow ");
})

You can click Close to close this layer.

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.