view.js实现PC端图片查看--简单使用

	//引入的文件
	<link href="pub/css/viewer.css" rel="stylesheet">
	<script type="text/javascript" src="pub/js/jquery.min.js"></script>
	<script type="text/javascript" src="pub/js/viewer.min.js"></script>


	//这是后台的图片数据,循环在table中显示
	function createTable(data, pageNum) {
	    var content = "";
	    if (data.row.length  > 0) {
	        $.each(data.row, function(i, item) {
	            content += '<tr>';
	            content += '<td style="color: #CFAF2F;">';
	            if(item.userImage){
	                content += '<img class="userImg" src="'+item.userImage+'" alt="" style="height: 20px;width: 20px;" onclick="showImg(this)">';
	            }else{
	
	            }
	            content += '</td>';
	            content += '</tr>';
	     });
	}


	//查看大图
	function showImg(a) {
	    $(a).viewer();
	}

猜你喜欢

转载自blog.csdn.net/Roriring/article/details/88351991
今日推荐