jquery realizes the _jquery of the image carousel of the Roadside light box advertisement

Source: Internet
Author: User

Special Effects Introduction

This picture slide is like roadside light box advertisement, roadside big billboard effect, led switch effect, and will keep at the lowest end of the page.

Demo diagram

How to use

1. Introduction of STYLE.CSS in Head area.

Copy Code code as follows:
<link rel= "stylesheet" href= "Css/style.css" type= "Text/css" charset= "Utf-8"/>

2, the HTML code on the </body> above:

<div class= "Palmtrees" ></div> <div class= "powerline" ></div> <div class= "City" ></ div> <div class= "container" > <div class= "ad" > <div id= "ad_1" class= "Ad_1" >         "  "  "    
      
      
        </div> <div id= "ad_2" class= "Ad_2" > < IMG class= "slice_1" src= "ads/ad2_slice01.jpg"/>  <im G class= "Slice_3" src= "ads/ad2_slice03.jpg"/>                    </div> </div> </div> <div class= "BillboarD "></div>

 

Note: Because one of the pictures that you switch is actually composed of 22 35*340 pictures. So, if you want to change the picture, you have to cut the picture into a series of 35*340 pictures, and then write the following format in sequence:

<div id= "Ad_n" class= "Ad_n" >                       &

 Lt;/div>

3, JS code placed at the bottom of the document:

<script src= "Jquery/jquery-1.8.3.min.js" type= "Text/javascript" ></script>
<script>
$ ( function () {      
 $ (' #ad_1 > img '). each (function (i,e) {
 Rotate ($ (this), 500,3000,i);
});
function Rotate (elem1,speed,timeout,i) {
 elem1.animate {' marginleft ': ' 18px ', ' width ': ' 0px '},speed,function () {
   var other;
   if (Elem1.parent (). attr (' id ') = = ' Ad_1 ') Other
     = $ (' #ad_2 '). Children (' img ')-eq (i);
   else
     = $ (' #ad_1 '). Children (' img '). EQ (i);
     Other.animate ({' marginleft ': ' 0px ', ' width ': ' 35px '},speed,function () {
     var f = function () {Rotate (other,speed, Timeout,i)};
     SetTimeout (f,timeout);
   });
}
;}); </script>

Special Effects Download Effect Demo

The above is the entire content of this article, I hope you can enjoy.

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.