jquery实现焦点图片随机切换效果的方法


Posted in Javascript onMarch 12, 2015

本文实例讲述了jquery实现焦点图片随机切换效果的方法。分享给大家供大家参考。具体如下:

1. 运行效果如下图所示:

jquery实现焦点图片随机切换效果的方法

2.完整实例代码点击此处本站下载。

3.完整代码如下:

<!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">

            <img src="img/new-ribbon.png" width="112" height="112" alt="New Ribbon" id="ribbon">

            <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"><img src="http://slidesjs.com/examples/standard/img/slide-1.jpg" width="570" height="270" alt="Slide 1"></a>

                    <a href="http://www.flickr.com/photos/stephangeyer/3020487807/" title="Taxi | Flickr - Photo Sharing!" target="_blank"><img src="http://slidesjs.com/examples/standard/img/slide-2.jpg" width="570" height="270" alt="Slide 2"></a>

                    <a href="http://www.flickr.com/photos/childofwar/2984345060/" title="Happy Bokeh raining Day | Flickr - Photo Sharing!" target="_blank"><img src="http://slidesjs.com/examples/standard/img/slide-3.jpg" width="570" height="270" alt="Slide 3"></a>

                    <a href="http://www.flickr.com/photos/b-tal/117037943/" title="We Eat Light | Flickr - Photo Sharing!" target="_blank"><img src="http://slidesjs.com/examples/standard/img/slide-4.jpg" width="570" height="270" alt="Slide 4"></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 by.” | Flickr - Photo Sharing!" target="_blank"><img src="http://slidesjs.com/examples/standard/img/slide-5.jpg" width="570" height="270" alt="Slide 5"></a>

                    <a href="http://www.flickr.com/photos/streetpreacher/2078765853/" title="twelve.inch | Flickr - Photo Sharing!" target="_blank"><img src="http://slidesjs.com/examples/standard/img/slide-6.jpg" width="570" height="270" alt="Slide 6"></a>

                    <a href="http://www.flickr.com/photos/aftab/3152515428/" title="Save my love for loneliness | Flickr - Photo Sharing!" target="_blank"><img src="http://slidesjs.com/examples/standard/img/slide-7.jpg" width="570" height="270" alt="Slide 7"></a>

                </div>

                <a href="#" class="prev"><img src="img/arrow-prev.png" width="24" height="43" alt="Arrow Prev"></a>

                <a href="#" class="next"><img src="img/arrow-next.png" width="24" height="43" alt="Arrow Next"></a>

            </div>

            <img src="img/example-frame.png" width="739" height="341" alt="Example Frame" id="frame">

        </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>

希望本文所述对大家的jQuery程序设计有所帮助。

Javascript 相关文章推荐
Track Image Loading效果代码分析
Aug 13 Javascript
JavaScript自定义事件介绍
Aug 29 Javascript
JavaScript判断密码强度(自写代码)
Sep 06 Javascript
jquery ajax应用中iframe自适应高度问题解决方法
Apr 12 Javascript
原生JavaScript实现合并多个数组示例
Sep 21 Javascript
js由下向上不断上升冒气泡效果实例
May 07 Javascript
JavaScript中日期的相关操作方法总结
Oct 24 Javascript
AngularJS单选框及多选框实现双向动态绑定
Jan 13 Javascript
javascript 继承学习心得总结
Mar 17 Javascript
Vue.JS入门教程之处理表单
Dec 01 Javascript
javascript function(函数类型)使用与注意事项小结
Jun 10 Javascript
详解阿里Node.js技术文档之process模块学习指南
Jan 04 Javascript
JavaScript数据结构与算法之栈详解
Mar 12 #Javascript
jQuery实现简单的日期输入格式化控件
Mar 12 #Javascript
Javascript数据结构与算法之列表详解
Mar 12 #Javascript
javascript实现 百度翻译 可折叠的分享按钮列表
Mar 12 #Javascript
基于jquery实现的自动补全功能
Mar 12 #Javascript
jquery实现页面百叶窗走马灯式翻滚显示效果的方法
Mar 12 #Javascript
window.open()实现post传递参数
Mar 12 #Javascript
You might like
php中使用临时表查询数据的一个例子
2013/02/03 PHP
PHP编程实现脚本异步执行的方法
2017/08/09 PHP
Yii2框架自定义验证规则操作示例
2019/02/08 PHP
php实现的简单多进程服务器类完整示例
2020/02/01 PHP
国外Lightbox v2.03.3 最新版 下载
2007/10/17 Javascript
jQuery选择器中含有空格的使用示例及注意事项
2013/08/25 Javascript
使用简洁的jQuery方法实现隔行换色功能
2014/01/02 Javascript
浅谈重写window对象的方法
2014/12/29 Javascript
JavaScript获取表单内所有元素值的方法
2015/04/02 Javascript
jQuery拖拽插件gridster使用指南
2015/04/21 Javascript
理解JavaScript表单的基础知识
2016/01/25 Javascript
jquery 遍历数组 each 方法详解
2016/05/25 Javascript
jQuery基于xml格式数据实现模糊查询及分页功能的方法
2016/12/25 Javascript
Bootstrap面板使用方法
2017/01/16 Javascript
使用vue与jquery实时监听用户输入状态的操作代码
2017/09/19 jQuery
vue中使用cropperjs的方法
2018/03/01 Javascript
JavaScript封装的常用工具类库bee.js用法详解【经典类库】
2018/09/03 Javascript
原生JS实现DOM加载完成马上执行JS代码的方法
2018/09/07 Javascript
详解Axios 如何取消已发送的请求
2018/10/20 Javascript
结合axios对项目中的api请求进行封装操作
2020/09/21 Javascript
微信小程序淘宝首页双排图片布局排版代码(推荐)
2020/10/29 Javascript
Python中的魔法方法深入理解
2014/07/09 Python
Django模板Templates使用方法详解
2019/07/19 Python
python Pillow图像处理方法汇总
2019/10/16 Python
python与pycharm有何区别
2020/07/01 Python
彻底搞懂python 迭代器和生成器
2020/09/07 Python
python中pow函数用法及功能说明
2020/12/04 Python
python实现跨年表白神器--你值得拥有
2021/01/04 Python
CSS3 不定高宽垂直水平居中的几种方式
2020/03/26 HTML / CSS
html标签之Object和EMBED标签详解
2013/07/04 HTML / CSS
Kangol帽子官网:坎戈尔袋鼠
2018/09/26 全球购物
几个SQL的面试题
2014/03/08 面试题
Java程序员面试90题
2013/10/19 面试题
大学生职业规划前言模板
2013/12/27 职场文书
小组名称和口号
2014/06/09 职场文书
长城导游词400字
2015/01/30 职场文书