【发布时间】:2012-03-25 00:43:07
【问题描述】:
我对 CSS 和 jQuery 有一些问题.. 我尝试使用幻灯片图像来隐藏、更改 src 并用幻灯片显示......当我使用精确参数“宽度”时一切都很好,例如500 px,或 50%,但我需要 width:auto 和 height 100%..
代码 CSS
#gallery img {
width:auto;
height:100%;
max-width:auto;
margin:0 auto;
display:block;
border:none;
}
#gallery {
position:absolute;
width:100%;
height:auto;
top:140px;
bottom:60px;
margin:0 auto;
display: block;
z-index:10;
overflow:none;
}
和 jQuery
$('#gallery').hide("slide", { direction: "left" }, 1000);
$('.gallery_img').attr('src', url);
$('#gallery').show("slide", { direction: "right" }, 1000);
我谷歌浏览器一切正常,但 IE 和 firefox 不支持这一点,图像在静态时具有正确的比例但当开始幻灯片宽度更改为自然大小 IMG...
有解决这个问题的办法吗? 谢谢
【问题讨论】:
-
您可以设置一个jsFiddle.net 或jsBin.com 来玩吗?谢谢
标签: jquery css width show-hide