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 相关文章推荐
jquery jqPlot API 中文使用教程(非常强大的图表工具)
Aug 15 Javascript
javascript算法题 求任意一个1-9位不重复的N位数在该组合中的大小排列序号
Jul 21 Javascript
js汉字转拼音实现代码
Feb 06 Javascript
js事件绑定快捷键以ctrl+k为例
Sep 30 Javascript
node.js中的fs.fchownSync方法使用说明
Dec 16 Javascript
jQuery中常用动画效果函数(日常整理)
Sep 17 Javascript
IE8兼容Jquery.validate.js的问题
Dec 01 Javascript
利用vueJs实现图片轮播实例代码
Jun 03 Javascript
Nuxt.js SSR与权限验证的实现
Nov 21 Javascript
在vue中使用jsx语法的使用方法
Sep 30 Javascript
vue实现在进行增删改操作后刷新页面
Aug 05 Javascript
javascript操作向表格中动态加载数据
Aug 27 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算开始时间到过期时间的相隔的天数
2011/01/12 PHP
php var_export与var_dump 输出的不同
2013/08/09 PHP
PHP的构造方法,析构方法和this关键字详细介绍
2013/10/22 PHP
php导出word文档与excel电子表格的简单示例代码
2014/03/08 PHP
Yii扩展组件编写方法实例分析
2015/06/29 PHP
php上传大文件失败的原因及应对策略
2015/10/20 PHP
使用PHP连接多种数据库的实现代码(mysql,access,sqlserver,Oracle)
2016/12/21 PHP
PHP利用百度ai实现文本和图片审核
2019/05/08 PHP
PHP使用观察者模式处理异常信息的方法详解
2019/09/24 PHP
input 高级限制级用法
2009/03/26 Javascript
初试jQuery EasyUI 使用介绍
2010/04/01 Javascript
js获取当前select 元素值的代码
2010/04/19 Javascript
JQury slideToggle闪烁问题及解决办法
2011/07/05 Javascript
javascript仿qq界面的折叠菜单实现代码
2012/12/12 Javascript
VS2008中使用JavaScript调用WebServices
2014/12/18 Javascript
javascript实现淡蓝色的鼠标拖动选择框实例
2015/05/09 Javascript
JS模仿手机端九宫格登录功能实现代码
2016/04/28 Javascript
Bootstrap 3.x打印预览背景色与文字显示异常的解决
2016/11/06 Javascript
js+html制作简单验证码
2017/02/16 Javascript
详解react内联样式使用webpack将px转rem
2018/09/13 Javascript
深入解析koa之异步回调处理
2019/06/17 Javascript
[58:42]DOTA2上海特级锦标赛C组败者赛 Newbee VS Archon第一局
2016/02/27 DOTA
python利用hook技术破解https的实例代码
2013/03/25 Python
解决Python传递中文参数的问题
2015/08/04 Python
pycharm安装图文教程
2017/05/02 Python
python 实现登录网页的操作方法
2018/05/11 Python
Python3内置模块之json编解码方法小结【推荐】
2020/12/09 Python
Python 利用argparse模块实现脚本命令行参数解析
2020/12/28 Python
Cotton On南非:澳洲时尚平价品牌
2018/06/28 全球购物
兰蔻英国官网:Lancome英国
2019/04/30 全球购物
美国滑板店:Tactics
2020/11/08 全球购物
社区关爱留守儿童活动方案
2014/08/22 职场文书
奥巴马上海演讲稿
2014/09/10 职场文书
大学生党员自我批评思想汇报
2014/10/10 职场文书
初中政治教学反思
2016/02/23 职场文书
你有一份《诚信考试承诺书》待领取
2019/11/13 职场文书