bootstrap image viewer 图片放大查看

bootstrap image viewer 图片放大查看

已封装成为插件欢迎使用及反馈

插件下载:(访问密码9987)
bootstrap-viewer.zip

bootstrap image viewer 图片放大查看

实现效果:
小图  
大图  

<!DOCTYPE html>
<html>
<head>
	<title>bootstrap 图片查看</title>
	<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>

<td>
	<center>
		<img style="height: 100px;width: 100px;" 
		onmouseover="this.style.cursor='pointer';this.style.cursor='hand'" 
		onmouseout="this.style.cursor='default'"  
		src="test.jpg" 
		onclick="javascript:showimage('./test.jpg');" />
	</center>
</td>
  

		<!--放大图的imgModal-->
        <div class="modal fade bs-example-modal-lg text-center" id="imgModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" >
          <div class="modal-dialog modal-lg" style="display: inline-block; width: auto;">
            <div class="modal-content">
             <img  id="imgInModalID"  
			 class="carousel-inner img-responsive img-rounded" 
			 onclick="closeImageViewer()"
			 onmouseover="this.style.cursor='pointer';this.style.cursor='hand'" 
			 onmouseout="this.style.cursor='default'"  
			 />
            </div>
          </div>
        </div>
<script src="https://cdn.bootcss.com/jquery/2.2.0/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

</body>
<script type="text/javascript">
	//显示大图    
   function showimage(source)
     {
         $("#imgModal").find("#imgInModalID").attr("src",source);
         $("#imgModal").modal();
     }
	 //关闭
	function closeImageViewer(){
		$("#imgModal").modal('hide');
	}
</script>
</html>

 

bootstrap image viewer 图片放大查看

相关文章:

你感兴趣的文章:

标签云: