Home > Web Front-end > JS Tutorial > body text

Implementation code for timing display and hiding of div ads based on jquery_jquery

WBOY
Release: 2016-05-16 17:24:43
Original
1248 people have browsed it

I will share with you my method below:

To show and hide layers in jquery, it is very simple to directly use the hide and show methods. But to set the timing, we need to use the setTimeout function to instantiate it. I will share my method with you below.
Let’s put some random things in the html page

Copy code The code is as follows:

jquery code

Copy code The code is as follows:


<script><br>$(function(){ <br>setTimeout('$( ".toolbarframe").show("slow")',3000);<br> setTimeout('$(".toolbarframe").hide("slow")',13000);<br> $(".bigad_close ").click(function(){<br> $(".toolbarframe").hide("slow");<br>})<br>});<br></script>

A brief introduction to the core implementation code above:

Copy code The code is as follows:

setTimeout('$(".toolbarframe").show ("slow")',3000); After three seconds, the div will slowly be displayed from small to large
setTimeout('$(".toolbarframe").hide("slow")',13000); After ten seconds, it will be displayed again Automatically hide divs from large to small
$(".bigad_close").click(function(){
$(".toolbarframe").hide("slow");
})

This is closed by the user. Click Close to close this layer.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!