芙姬情感网
您的当前位置:首页jquery渐隐渐显的图片幻灯闪烁切换实现方法_jquery

jquery渐隐渐显的图片幻灯闪烁切换实现方法_jquery

来源:芙姬情感网
 本文实例讲述了jquery渐隐渐显的图片幻灯闪烁切换实现方法。分享给大家供大家参考。具体实现方法如下:

代码如下:


jQuery渐隐渐显的图片幻灯闪烁切换效果

与之间-->



$(function(){
var _img=$('.slides img');
var _len=_img.length;
var _index=0;
var _moving;
//插入图片索引数字
var _ul=''
for(var i=1; i<=_len; i++){
_ul=_ul+'

  • '+i+'
  • ';
    }
    _ul=_ul+'';
    $('div.ico').append(_ul);
    var _ico=$('.ico li');
    //划过数字
    _ico.mouseover(function(){
    _index=_ico.index(this);
    _img.filter(':visible').fadeOut(300,function(){
    _img.eq(_index).fadeIn(300);
    })
    $(this).addClass('high').siblings().removeClass('high');
    }).eq(0).mouseover();
    //自动渐变
    _moving=setInterval(autoShow,2000);
    _img.hover(function(){clearInterval(_moving)},function(){
    _moving=setInterval(autoShow,2000);
    })
    function autoShow(){
    _index++;
    if(_index==_len) _index=0;
    _ico.eq(_index).trigger('mouseover');
    };
    });



    预览效果时左下角会提示错误,而且看不到效果,刷新一下就可以看到效果了;当然,在实际使用中,不会出现这样的问题。

    与之间-->









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

    显示全文