0

我目前正在使用 jquery 库使用 javascript 编写轮播。基本上,显示了三个图像,中央图像比其他两个图像大。在向左或向右移动时,中心图像的大小从 115px*115px 调整为 50px*50px,并根据用户输入向左或向右移动。

问题是,当调整大小时,中心图像会逐渐被裁剪,直到达到 50px*50px,然后恢复到更正常的状态: http://www.filedropper.com/imggetscropped

Javascript如下:

$("div#carousel .item:eq(2)").animate({'width':'50px', 'height':'50px', 'opacity':'0.5'}, {queue:false, duration:900});  
$("div#carousel .item:eq(2) img").animate({'width':'50px', 'height':'50px', 'marginTop': '30px'}, {queue:false, duration:900});  
$("div#carousel .item:eq(1)").animate({'width':'115px', 'height':'115px', 'opacity':'1'}, {queue:false, duration:900});  
$("div#carousel .item:eq(1) img").animate({'width':'115px', 'height':'115px', 'marginTop': '0px'}, {queue:false, duration:900});  
$("div#carousel .item:not(eq(2))").animate({'left':'+=56px'}, {queue:false, duration:900});  
$("div#carousel .item:eq(2)").animate({'left':'+=122px'}, {queue:false, duration:900, complete: carousel.toggleInput});  

使用的图像是具有透明度的 png。

4

1 回答 1

2

从这段代码中,看起来您的图像在容器中

如果是这种情况,也许您调整了容器的大小,而不是图像本身。

如果容器溢出,这将导致裁剪:隐藏;在 CSS 中

但要确保我们需要查看与此代码相关的 css 和基本 html 结构

于 2010-05-07T13:31:59.200 回答