css/jquery 用动画放大
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20233844/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
css/jquery zoom in with animation
提问by subho das
I wish to zoom in a div on click. I was trying to zoom in with a smooth animation. Here is my code. Please correct me where I am wrong!
我希望在单击时放大 div。我试图用流畅的动画放大。这是我的代码。请指正我错的地方!
$(".contentBox img").click(function(){
$("#mixedContent").animate({zoom: '150%'}, slow);
});
Thanks -
谢谢 -
采纳答案by LarsEngeln
That should do the trick. (using zoom) -
But I would suggest $("identifier").on("click", function(){});
(more up to date)
这应该够了吧。(使用缩放) - 但我建议$("identifier").on("click", function(){});
(更新)
Remember also:
还要记住:
zoom: 100%; // at least IE, Chrome
-moz-transform: scale(1.0);
-webkit-transform: scale(1.0);
回答by Fred K
Put slow
between quotes:
放在slow
引号之间:
$(".contentBox img").click(function(){
$("#mixedContent").animate({zoom: '150%'}, "slow");
});
回答by singhiskng
use something like height:'+=100',width:'+=100'
instead of zoom
.
使用类似的东西height:'+=100',width:'+=100'
而不是zoom
.