Jquery implements the Random Switching of focus images, and jquery implements focus switching.
This example describes how jquery achieves Random Switching of focus images. Share it with you for your reference. The details are as follows:
1. Shows the running effect:
2. Click here to download the complete instance code.
3. The complete code is as follows:
Copy codeThe Code is as follows:
<! DOCTYPE html>
<Html lang = "en">
<Head>
<Meta charset = "UTF-8">
<Title> Slides, A Slideshow Plugin for jQuery </title>
<Link rel = "stylesheet" href = "css/global.css">
<Script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"> </script>
<Script src = "http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js"> </script>
<Script src = "js/slides. min. jquery. js"> </script>
<Script>
$ (Function (){
Var easings = [];
Var row = 0;
For (var x in jQuery. easing ){
If (x! = 'Linear '& x! = 'Swing '){
Easings [row ++] = x;
}
}
$ ('# Slides'). slides ({
Preload: true,
PreloadImage: 'img/loading.gif ',
Play: 5000,
Pause: 2500,
SlideEasing: "swing ",
SlideSpeed: 2000,
HoverPause: true,
AnimationComplete: function (current ){
Var index = Math. floor (Math. random () * easings. length );
JQuery. easing. def = easings [index];
}
});
});
</Script>
</Head>
<Body>
<Div id = "container">
<Div id = "example">
<Div id = "slides">
<Div class = "slides_container">
<A href = "http://www.flickr.com/photos/jliba/4665625073/" title = "145.365-Happy Bokeh Thursday! | Flickr-Photo Sharing! "Target =" _ blank "> </a>
<A href = "http://www.flickr.com/photos/stephangeyer/3020487807/" title = "Taxi | Flickr-Photo Sharing! "Target =" _ blank "> </a>
<A href = "http://www.flickr.com/photos/childofwar/2984345060/" title = "Happy Bokeh raining Day | Flickr-Photo Sharing! "Target =" _ blank "> </a>
<A href = "http://www.flickr.com/photos/b-tal/117037943/" title = "We Eat Light | Flickr-Photo Sharing! "Target =" _ blank "> </a>
<A href = "http://www.flickr.com/photos/bu7amd/3447416780/" title = "" I must go down to the sea again, to the lonely sea and the sky; and all I ask is a tall ship and a star to steer her. "| Flickr-Photo Sharing! "Target =" _ blank "> </a>
<A href = "http://www.flickr.com/photos/streetpreacher/2078765853/" title = "twelve. inch | Flickr-Photo Sharing! "Target =" _ blank "> </a>
<A href = "http://www.flickr.com/photos/aftab/3152515428/" title = "Save my love for loneliness | Flickr-Photo Sharing! "Target =" _ blank "> </a>
</Div>
<A href = "#" class = "prev"> </a>
<A href = "#" class = "next"> </a>
</Div>
</Div>
<Div id = "footer">
<P> For full instructions go to <a href = "http://slidesjs.com" target = "_ blank"> http://slidesjs.com </a>. </p>
<P> Slider design by Orman Clark at <a href = "http://www.premiumpixels.com/" target = "_ blank"> Premium Pixels </a>. you can donwload the source PSD at <a href = "http://www.premiumpixels.com/clean-simple-image-slider-psd/" target = "_ blank"> Premium Pixels </a> </p>
<P>©2010 <a href = "http://nathansearles.com" target = "_ blank"> Nathan Searles </a>. all rights reserved. slides is licensed under the <a href = "http://www.apache.org/licenses/LICENSE-2.0" target = "_ blank"> Apache license </a>. </p>
</Div>
</Div>
</Body>
</Html>
I hope this article will help you with jQuery programming.