jQuery点击图片放大拖动查看效果

效果如图:

放大前:

放大后(可拖动图片浏览):

源码如下:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>jQuery点击图片拖动放大查看效果</title>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.imageView.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#imageView_container').imageView({ width: 850, height: 708 });
        });
    </script>
    <style type="text/css">

        body {
            background-color: #555;
            color: #fff;
        }

        a img {
            border: none;
        }

        #imageView_container {
            border: 2px solid #000;
            margin: 0 auto;
        }

            #imageView_container.iv-loading {
                border: 2px solid #ff6600;
            }
    </style>
</head>
<body>
    <div id="imageView_container" class="" style="width: 850px; height: 708px; overflow: hidden; position: relative; cursor: -moz-zoom-in;">
        <img src="http://www.xwcms.net/webAnnexImages/fileAnnex/201506/27268/images/12awe51.jpg" rel="http://www.xwcms.net/webAnnexImages/fileAnnex/201506/27268/images/sad2.jpg" alt="" id="image_view_1" style="visibility: visible; position: absolute; left: 0px; top: 0px;">
    </div>
</body>
</html>

 

js资源下载地址:https://pan.baidu.com/s/1ew7iernrBAWZ0kuhr21s0A#list/path=%2F

转载于:https://www.cnblogs.com/mlinber/p/9783301.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值