我想做个大小图的切换功能,现在第一次小图切换到大图有闪烁现象,希望鼠标移到小图时就延迟加载大图,网上说用jquery lazload,但是不知道怎么用的,有人用过吗,我用了第一次切换时还是有闪烁现象。代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery.lazyload.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
   $(".image").find('img').click(function() {
   bind_image($(this)[0]);
   });
     
  $(".image").find('img').hover(function(){
   $("http://testv.pp.cc/static/img/index_big.png").lazyload();  
  }, function(){});
});function bind_image(obj)
{
   var narrow = $(obj).next().hasClass('narrow');   if ( ! narrow)
   {
   $(obj).after('<img src="http://testv.pp.cc/static/img/index_big.png" class="narrow"/>');
   }
     
  $(obj).hide();
   $(this).parent().css("width", $(this).width());
   $(obj).next().show();
     
  $(obj).next().click(function() {
   $(this).hide();
   $(this).prev().show();
   });
}
</script>
<div class="image">
   <img src="http://testv.pp.cc/static/img/index_small.png">
</div>lazload插件下载:http://www.appelsiini.net/download/jquery.lazyload.js