账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    【求助】div里的图片怎么实现中心放大效果?
    28
    0

    参考https://www.jb51.net/article/...,修改了代码如下:
    但是出来的效果是左上开始的放大的效果
    怎么在div里的img实现中心的放大效果呢?

    <script type="text/javascript">
    function fangda(){
        var pic=$('.pictures img');
        var wValue=20+pic.width();
        var hValue=20+pic.height();
        pic.animate({width: wValue, height: hValue, left:("-"+(0.5 * pic.width())/2), top:("-"+(0.5 * pic.height())/2)}, 1000);
    }
    </script>
    <body>
    <button onclick="fangda()">图片放大</button>
    <style>
    .pictures {
        width: 414px;
        height: 390px;
        overflow: hidden;
    }    
    </style>
    <div class="pictures">
        <img src="3.jpg">
    </div>
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部