<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>手機端點擊圖片全屏預覽</title>
<script src="http://www.jq22.com/jquery/jquery-2.1.1.js"></script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
</head>
<body>
<div>
</div>
<div class="category">
<img src="1.jpg" class="pic" width="300px">
<img src="2.jpg" class="pic" width="300px">
</div>
<script>
// 點擊查看大圖
function funcReadImgInfo(){
var imgs = [];
var imgObj = $(".category .pic");//這里改成相應的對象
for(var i=0; i<imgObj.length; i++){
imgs.push(imgObj.eq(i).attr('src'));
imgObj.eq(i).click(function(){
var nowImgurl = $(this).attr('src');
WeixinJSBridge.invoke("imagePreview",{
"urls":imgs,
"current":nowImgurl
});
});
}
}
$(function(){
funcReadImgInfo();
});
</script>
</body>
</html>
————————————————
版權聲明:本文為CSDN博主「Kathy_LLi」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/Kathy_Hui/article/details/82460590