【问题标题】:jQuery SHOW / HIDE slide image with 'auto width'带有“自动宽度”的 jQuery SHOW / HIDE 幻灯片图像
【发布时间】: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...

有解决这个问题的办法吗? 谢谢

【问题讨论】:

标签: jquery css width show-hide


【解决方案1】:

我认为您必须使用 Jquery 来设置它,而不是 css。如果你在 css 中将宽度设置为 100%,那就是……100%。

【讨论】:

    猜你喜欢
    • 2013-02-18
    • 2015-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-18
    • 1970-01-01
    • 2012-03-03
    相关资源
    最近更新 更多