首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > JavaScript > js实现网页背景自动淡入淡出

js实现网页背景自动淡入淡出

资 源 简 介

1.使用jquery使用 网页全屏背景图片自动淡入淡出效果 var _index=0; var $img; var imgNum; $(function(){    $img=$("img");//一次获取图片对象引用,减少重复获取的内存消耗         imgNum=$img.size();         $img.each(function(){//初始化图片透明度,除了最后一个显示,其余全透明           $(this).css({opacity:0});  $img.eq(imgNum-1).css({opacity:1}); }) setInterval(exchangBj,5000); })   function exchangBj(){ $img.each(function(){   if($(this).css("opacity")==1){         $(this).animate({opacity:0},3000);   }           }) if(_index>=imgNum){            _index=0;   } $img.eq(_index).animate({opacity:1},3000); _index ++; }   

文 件 列 表

images
1.jpg
2.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7.jpg
8.jpg
left.png
right.png
index.html
js
jquery-1.9.1.js
VIP VIP
0.175292s