JQUERY多变的幻灯片-COOLCAROUSELS-经典

所属分类:媒体-幻灯片和轮播图

 27983  278  查看评论 (0)
分享到微信朋友圈
X
JQUERY多变的幻灯片-COOLCAROUSELS-经典 ie兼容8

CoolCarousels集合了多种模式的幻灯片,每种模式都有不同德样式和外观,基于jQuery库构建而成。有带有缩略图导航的幻灯片,有包含动态项的旋转木马等等,你基本上可以在这里找到所有类型的幻灯片。到目前为止,CoolCarousels一共有65种类型,那么接下来我就挑选其中的一些来讲解。

使用步骤

1、引入以下的js和css文件

<script src="http://code.jquery.com/jquery-1.8.2.min.js"type="text/javascript"></script>
<script src="jquery.carouFredSel-6.2.0-packed.js" type="text/javascript"></script>


2、在head标签中加入以下js代码

<script type="text/javascript">
    $(function() {
    var $imgs = $('#images .carousel'),
    $capt = $('#captions .carousel'),
    $timr = $('#timer');
 
    $imgs.carouFredSel({
        circular: false,
        scroll: {
            easing: 'quadratic',
            duration: 2,
            timeoutDuration: 3000,
            onBefore: function( data ) {
                   $capt.trigger( 'slideTo', [ '.' + data.items.visible.first().attr( 'alt' ) ] );
                $timr.stop().animate({
                    opacity: 0
                }, data.scroll.duration);
            },
            onAfter: function() {
                $timr.stop().animate({
                    opacity: 1
                }, 150);
            }
        },
        auto: {
             progress: '#timer'
         },
        pagination: {
            container: '.pager',
            anchorBuilder: function( i ) {
                return '<a class="p' + i + '" href="#"></a>';
            }
        }
        });
        $capt.carouFredSel({
              circular: false,
            auto: false,
            scroll: {
                easing: 'quadratic',
                duration: 2
            }
        });
});
</script>


3、在body标签中加入幻灯片整个外部div容器的html代码

<div id="wrapper">
    //图片代码 4
 //计时器代码  5
 //图片文字描述代码  6
</div>


4、在 div #wrapper 中加入图片代码,注意:这里有9张图片,但是大家会发现,图片的 alt 属性可能会不一样,那么这个属性有什么用呢?
其实 alt 属性就是对应到6中的图片文字。

<div id="images">
     
    <div class="carousel">
        <img src="img/cod1.jpg" alt="cod" width="700" height="350"> <imgsrc="img/cod2.jpg" alt="cod" width="700" height="350"> <img src="img/cod3.jpg"alt="cod" width="700" height="350"> <img src="img/gta1.jpg" alt="gta"width="700" height="350"> <img src="img/gta2.jpg" alt="gta" width="700"height="350"> <img src="img/gta3.jpg" alt="gta" width="700" height="350"> <imgsrc="img/mgs1.jpg" alt="mgs" width="700" height="350"> <img src="img/mgs2.jpg"alt="mgs" width="700" height="350"> <img src="img/mgs3.jpg" alt="mgs"width="700" height="350">
    </div>
 
</div>


5、在 div #wrapper 中加入计时器代码,就是一个ID为timer的div

<div id="timer">
     
</div>


6、在 div #wrapper 中加入图片文字描述代码,这里的div #cod #gta #mgs 实际上就是对应到4中图片的 alt 属性的。这样就能对应出每个图片显示什么描述文字。这样做的好处就是可以多张图片共享一则公共的文字描述。

<div id="captions">
     
    <div class="carousel">
         
        <div class="cod">
            Call Of Duty
            <div class="pager">
                 
            </div>
 
        </div>
 
        <div class="gta">
            Grand Theft Auto
            <div class="pager">
                 
            </div>
 
        </div>
 
        <div class="mgs">
            Metal Gear Solid
            <div class="pager">
                 
            </div>
 
        </div>
 
    </div>
 
</div>			


当然还牵涉到一些css样式,我在这就不写出来了,大家可以查看源码中的 Demo.


参数配置

CoolCarousels的调用js代码我已经在上面写出来了,所以可以配置的参数就从里面找了,无非就是幻灯片播放速度之类的参数,大家自行配制吧。

相关插件-幻灯片和轮播图

简单实用的全屏轮播

有多重选项,配置迅速,十分实用
  幻灯片和轮播图
 44239  382

原生JS响应式无限循环轮播图(原创)

一个简单的原生JS轮播图,响应式的,动画效果靠的是transfm,如果大佬改一下说不定就可以兼容IE8、9了
  幻灯片和轮播图
 41889  374

根据浏览器宽度大小自动调整图片的jquery相册代码

根据浏览器宽度大小自动调整图片的jquery相册代码
  幻灯片和轮播图
 25810  319

有道的banner轮播切换效果js实例

基于swiper的banner切换效果js实例,自适应轮播图
  幻灯片和轮播图
 47812  460

讨论这个项目(0)回答他人问题或分享插件使用方法奖励jQ币 评论用户自律公约

😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
😃
  • 😀
  • 😉
  • 😥
  • 😵
  • 😫
  • 😘
  • 😡
  • 👍
  • 🌹
  • 👏
  • 🍺
  • 🍉
  • 🌙
  • 💖
  • 💔
取消回复