欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery實(shí)現(xiàn)鼠標(biāo)滑過(guò)小圖時(shí)顯示大圖的方法

 更新時(shí)間:2015年01月14日 11:29:55   投稿:shichen2014  
這篇文章主要介紹了jquery實(shí)現(xiàn)鼠標(biāo)滑過(guò)小圖時(shí)顯示大圖的方法,涉及圖片及鼠標(biāo)操作的技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了jquery實(shí)現(xiàn)鼠標(biāo)滑過(guò)小圖時(shí)顯示大圖的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

復(fù)制代碼 代碼如下:
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title></title>
</head>
<style type="text/css">
li{list-style:none;float:left;margin-left:10px;}
</style>
<script type="text/javascript" src="jquery-1.8.2.min.js"></script>
<script type="text/javascript">
 var data = {
  "images/11_s.jpg":["images/11_b.jpg","美人1"],
  "images/22_s.jpg":["images/22_b.jpg","美人2"],
  "images/33_s.jpg":["images/33_b.jpg","美人3"],
  "images/44_s.jpg":["images/44_b.jpg","美人4"]
 };
 $(function(){
  $.each(data,function(key,value){
   //初始化最后一個(gè)div為隱藏
   $("div").last().hide();
   //創(chuàng)建小圖的節(jié)點(diǎn)
   var smallPath = $("<img src='" + key + "' />").css({"margin":"5px","padding":"2px","border":"1px solid #000"});
   //設(shè)置大圖地址和名稱
   bigImgPath = smallPath.attr("bigMapPath",value[0]);
   bigImgName = smallPath.attr("bigMapName",value[1]);

   $("div").first().append(smallPath);

   //小圖上添加事件
   smallPath.mouseover(function(){
    //最后一個(gè)div淡入效果
    $("div").last().fadeIn("fast");
    //獲取大圖地址
    $("#show").attr("src",$(this).attr("bigMapPath"));
    //獲取大圖名稱并設(shè)置樣式
    $("#imgTitle").text($(this).attr("bigMapName")).css({"background":"#ebf1de","padding":"10px","margin-bottom":"10px"});
   });
   smallPath.mouseout(function(){
    $("div").last().fadeOut("fast");
   });
  });
 });
</script>
<body>
<div></div>
<div>
 <img id="show" src="" />
</div>
</body>
</html>

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論