如何使用jQuery缩放页面加载中的div?

有没有办法在页面加载时进行div放大? 就像在Chrome中安装新应用时一样,它会将您带到新标签页并放大新应用。 看起来很好。

任何人都知道如何使用jQuery做到这一点?

这是使用jQuery进行缩放的一种方法

示例jsfiddle

在CSS中设置起始尺寸(以及topleft位置偏移):

 #zoom-box { background: #7d7e7d; background: linear-gradient(top, #7d7e7d 0%,#0e0e0e 100%); border-radius:10px; width:0; height:0; position:relative; top:150px; left:150px; border:solid 4px yellow; font-size:0; line-height:0; vertical-align:middle; text-align:center; color:#fff; } 

然后用jQuery animate()方法resize

 $('#zoom-box').animate({ width:'300px', height:'300px', top:'0', left:'0', 'font-size':'50px', 'line-height':'300px' }, 1000); 

您将需要放大DIV内的所有内容,如图像,增加文本大小等…

也许有jQuery的缩放插件。

CSS:

 div { width:50px; height:50px; margin:20px; background-color:red; font-size:1em; } .big { width:100px; height:100px; font-size:2em; } 

JQuery(使用JQueryUI):

 $(function(){ $('#my_div').addClass("big",500).removeClass("big",500); }); 

这是演示: http : //jsfiddle.net/tjRvn/

不幸的是,持续时间的addClass()今晚在Chrome中不起作用。 奇怪的 :/