jquery to achieve both sides of the floating closed couplet ads _jquery

Source: Internet
Author: User

Effect Display:

Code Description:

Can be closed on both sides of the floating couplet ad code jquery effect, widescreen resolution greater than 1024px to display. Because considering the narrow screen display couplet ads that is really user experience is very poor.

Click on the Close button to separate your side of the floating couplet advertising code.

JS code in the var screen_w = screen.width; if (screen_w>1024) {duilian.show ();} is jquery's resolution of the browser, you can modify the browser resolution values that are required for the left and right side of the floating couplet code, and if you don't want to make a decision, you can delete these two sentences. Let's post CSS code. Duilian{top:260px;position:absolute; width:102px; overflow:hidden; display:none;} In the Display:none, delete the browser resolution is not judged.

Click on both sides of the floating couplet advertising code below the close can close their own half of the ads.

Some of the HTML code is as follows:

<!--The following is the HTML code structure-->
<div class= "Duilian duilian_left" > <div class= "
 Duilian_con" > Content of couplet </div>
 <a href= "#" class= "Duilian_close" >x off </a>
</div>
<div class= " Duilian duilian_right ">
 <div class=" Duilian_con "> Couplet content </div>
 <a href=" # "class=" Duilian_ Close ' >x </a>
</div>

Some CSS code is as follows:

/* Below is the CSS code for the advertisement * * *

duilian{top:260px;position:absolute; width:102px; overflow:hidden; display:none;
duilian_left{left:6px}
. DUILIAN_RIGHT{RIGHT:6PX}
. Duilian_con{border: #CCC solid 1px; width:100px; height:300px; overflow:hidden;}
. duilian_close{width:100%; height:24px; line-height:24px; text-align:center; display:block; font-size:13px; color:# 555555; Text-decoration:none;}

Part of the right side of the floating couplet advertising code is as follows:

<script type= "Text/javascript" >
$ (document). Ready (function () {
 var Duilian = $ ("Div.duilian");
 var duilian_close = $ ("A.duilian_close");
 var screen_w = screen.width;
 if (screen_w>1024) {duilian.show ();}
 $ (window). Scroll (function () {
  var scrolltop = $ (window). scrolltop ();
  Duilian.stop (). Animate ({top:scrolltop+260});
 });
 Duilian_close.click (function () {
  $ (this). Parent (). Hide ();
  return false;
 }
); </script>

under a piece of code is very simple to achieve jquery on both sides of the floating couplet advertising code

The content of this section:

On both sides of the floating couplet advertising code.

Example:

jquery implementation of the couplet advertising code

The sample code looks like this:

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 

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.