jquery 高级教程$jQuery图片预加载插件

http://www.117178.com/jsxiangguan/20100327/2kz8w2z5f11997579703.html


<script>
/*jQuery图片预加载插件。 DevByCssRain.cn*/
jQuery.fn.loadthumb=function(options){
options=$.extend({
  src:""
},options);
var_self=this;
_self.hide();
varimg=newImage();
$(img).load(function(){
  _self.attr("src",options.src);
  _self.fadeIn("slow");
}).attr("src",options.src); //.atte(&qujquery视频教程ot;src",options.src)要放在load后面,
return_self;
}

$jquery入门教程(document).ready(function(){
varlen =$(".num>li").length;
varindex=0;
varadTimer;
$(".numli").mouseover(function(){
  index =  $(".numli").index(this);
  showImg(index);
}).eq(0).mouseover();
//滑入停止动画,滑出开始动画.
$('.ad').hover(function(){
   clearInterval(adTimer);
  },function(){
   adTimer=setInterval(function(){
      index++;
    if(index==len){index=0;}
    showImg(index);   
    },5000);
}).trigger("mouseleave");
});

functionshowImg(index){
  //定义图片的src
  varsrc=;
  //运用图片预加载插件
  $(".jquery ajax getadimg").loadthumb({src: src});
  $(".numli").removeClass("on")
   .eq(index).addClass("on");
}

</script>
<divclass="ad"><imgalt=""src="../images/1.gif"/>
<ulclass="num">
   <li>1</li&gjquery 日期插件t;
   <li>2</li>
   <li>3</li>
   <li>4</li>
   <li>5</li>
</ul>
</div>

你可能感兴趣的:(html,jquery,Ajax)