简体   繁体   English

如何缩放整个div?

[英]How to zoom an entire div?

I'm fooling around with a function right now on this page . 我现在正在这个页面上愚弄一个函数。

If you click the "who" section the div rotates. 如果单击div旋转的“who”部分。 I'd like it to zoom and consume the page. 我想要它来缩放和使用页面。

Is this possible? 这可能吗? How can this be done? 如何才能做到这一点?

After it rotates, set its width and height to be the width and height of the page. 旋转后,将其宽度和高度设置为页面的宽度和高度。

$('#who').rotate({
    angle:-90,
    bind: [{
        click: function(){
            $(this).rotateAnimation(0);
        }
    }], // remove the trailing comma here
    callback: function (){
        var $window = $(window);
        $(this).height($window.height()).width($window.width());
    }
});

Edit re: OP's comments 编辑重新:OP的评论

$('#who').rotate({
    angle: -90,
    bind: [{
        click: function(){
            $(this).rotateAnimation(0);
        }
    }],
    callback: function (){
        $(this).width(800).height(600);
    }
});

See .height() and .width() . 请参阅.height().width()


Edit #2 编辑#2

With your current CSS, you need to scale the img . 使用当前的CSS,您需要扩展img

$('#who').rotate({
    angle: -90,
    bind: [{
        click: function(){
            $(this).rotateAnimation(0);
        }
    }],
    callback: function (){
        $('#who > img').animate({height: 600, width: 800});
    }
});

If you change, say, the image's height and width to be 100% then you only need to change the size of the div and the image should scale with it. 如果您将图像的heightwidth更改为100%则只需更改div的大小,图像应随之缩放。

$('#who').animate({height: 600, width: 800});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM