js實(shí)現(xiàn)產(chǎn)品縮略圖效果
更新時(shí)間:2017年03月10日 11:25:53 作者:gsc756374668ts
本文主要介紹了js實(shí)現(xiàn)產(chǎn)品縮略圖效果的實(shí)例。具有很好的參考價(jià)值。下面跟著小編一起來看下吧
效果圖:

代碼如下:
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://how2j.cn/study/js/jquery/2.0.0/jquery.min.js"></script>
<link rel="external nofollow" rel="stylesheet">
<script src="http://how2j.cn/study/js/bootstrap/3.3.6/bootstrap.min.js"></script>
</head>
<script>
$(function(){
$("img.smallImage").mouseenter(function(){
var bigImageURL = $(this).attr("bigImageURL");
$("img.bigImg").attr("src",bigImageURL);
});
$("img.bigImg").load(
function(){
$("img.smallImage").each(function(){
var bigImageURL = $(this).attr("bigImageURL");
img = new Image();
img.src = bigImageURL;
img.onload = function(){
console.log(bigImageURL);
$("div.img4load").append($(img));
};
});
}
);
});
</script>
<style>
div.imgAndInfo{
margin: 40px 20px;
}
div.imgInimgAndInfo{
width: 400px;
float: left;
}
div.imgAndInfo img.bigImg{
width: 400px;
height: 400px;
padding: 20px;
border: 1px solid #F2F2F2;
}
div.imgAndInfo div.smallImageDiv{
width: 80%;
margin: 20px auto;
}
div.imgAndInfo img.smallImage{
width: 60px;
height: 60px;
border: 2px solid white;
}
div.imgAndInfo img.smallImage:hover{
border: 2px solid black;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div class="imgAndInfo">
<div class="imgInimgAndInfo">
<img width="100px" class="bigImg" src="http://how2j.cn/tmall/img/productSingle/8619.jpg">
<div class="smallImageDiv">
<img width="100px" class="smallImage" src="http://how2j.cn/tmall/img/productSingle_small/8620.jpg" bigImageURL="http://how2j.cn/tmall/img/productSingle/8620.jpg">
<img width="100px" class="smallImage" src="http://how2j.cn/tmall/img/productSingle_small/8619.jpg" bigImageURL="http://how2j.cn/tmall/img/productSingle/8619.jpg">
<img width="100px" class="smallImage" src="http://how2j.cn/tmall/img/productSingle_small/8618.jpg" bigImageURL="http://how2j.cn/tmall/img/productSingle/8618.jpg">
<img width="100px" class="smallImage" src="http://how2j.cn/tmall/img/productSingle_small/8617.jpg" bigImageURL="http://how2j.cn/tmall/img/productSingle/8617.jpg">
<img width="100px" class="smallImage" src="http://how2j.cn/tmall/img/productSingle_small/8616.jpg" bigImageURL="http://how2j.cn/tmall/img/productSingle/8616.jpg">
</div>
<div class="img4load hidden" ></div>
</div>
<div style="clear:both"></div>
</div>
以上就是本文的全部?jī)?nèi)容,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來一定的幫助,同時(shí)也希望多多支持腳本之家!
相關(guān)文章
BootStrap實(shí)現(xiàn)文件上傳并帶有進(jìn)度條效果
這篇文章主要介紹了BootStrap實(shí)現(xiàn)文件上傳并帶有進(jìn)度條效果,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-09-09
原生JS與jQuery編寫簡(jiǎn)單選項(xiàng)卡
這篇文章主要為大家詳細(xì)介紹了原生JS與jQuery編寫簡(jiǎn)單選項(xiàng)卡,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-10-10
javascript 設(shè)計(jì)模式之組合模式原理與應(yīng)用詳解
這篇文章主要介紹了javascript 設(shè)計(jì)模式之組合模式原理與應(yīng)用,結(jié)合實(shí)例形式分析了javascript組合模式基本概念、原理、應(yīng)用場(chǎng)景及操作注意事項(xiàng),需要的朋友可以參考下2020-04-04
javascript類型系統(tǒng) Window對(duì)象學(xué)習(xí)筆記
這篇文章主要介紹了javascript類型系統(tǒng)之Window對(duì)象,整理關(guān)于Window對(duì)象的學(xué)習(xí)筆記,感興趣的小伙伴們可以參考一下2016-01-01
JavaScript指定斷點(diǎn)操作實(shí)例教程
這篇文章主要給大家介紹了關(guān)于JavaScript指定斷點(diǎn)操作的相關(guān)資料,文中通過圖文介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2018-09-09
JavaScript實(shí)現(xiàn)將阿拉伯?dāng)?shù)字轉(zhuǎn)換成中文大寫
現(xiàn)在有需求將億元之內(nèi)的阿拉伯?dāng)?shù)字轉(zhuǎn)換成中文,例如:1234轉(zhuǎn)換后變?yōu)橐磺Ф偃脑俎D(zhuǎn)換成壹仟貳佰叁拾肆,所以本文給大家介紹了用JavaScript實(shí)現(xiàn)將阿拉伯?dāng)?shù)字轉(zhuǎn)換成中文大寫,感興趣的小伙伴跟著小編一起來看看吧2024-05-05

