Add ads dynamically with jquery

Source: Internet
Author: User

Websites, some sites always advertise on the bottom right, upper left, or elsewhere.

I use jquery to try to make a self, the code is as follows, if there is a wrong place please advise

1<! DOCTYPE html>2"http://www.w3.org/1999/xhtml">34<meta http-equiv="Content-type"Content="text/html; Charset=utf-8"/>5<title></title>6<script src="Jquery-1.8.3.js"></script>7<script type="Text/javascript">8 $ (function () {9$('#btn'). Click (function () {Ten                 //Creating Layers One                 varDivobj = $ ('<div style= "Width:200px;height:200px;position:absolute;right:0;bottom:0;background-color:orange" > </div>'). AppendTo ($ ('Body')); A                 //Create a Close button in the upper right corner -$('<sapn style= "Float:right;cursor:pointer border:3px solid gray" >X</span>'). Click (function () { -$( This). Parent (). remove (); the }). AppendTo ($ (divobj)); -                 //Add ad content -  -             }); +         }); -</script> + A<body> at<input type="Button"Name="name"Value="Show Effect"Id="btn"/> -</body> -

As follows

On this effect, I have the following thoughts:

1. You can add a timer, Countdown ' and 5S off ', and ' 4S off ', tell users that this ad is only temporary delivery, 5S automatically closed, this can enhance the user's experience, we all know that when browsing some websites, advertising always occupy the place in front of your eyes, the user experience is certainly not very good, this can be very good in the advertiser and user experience between the two to carry out a balance;

2. Background color Choose orange, because Orange is warm, personal experience, if the advertising background is warm words, more willing to let him stay some time, relative than the background color is cool advertising;

3. Of course, this is only a small code, the great god of the content after the completion of the package can be encapsulated, it will certainly be more convenient to use.

Add ads dynamically with jquery

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.