css - 水平滚动页面上 100% 宽度的图像

标签 css image width horizontal-scrolling

我正在尝试为照片故事制作一个页面 - 它旨在水平滚动,但我还希望图像缩放到 100% 高度和自动宽度(因此不裁剪)。水平滚动和 100% 高度/自动宽度没有问题。但我无法让图像正确间隔 - 它们一直重叠。请参阅:http://i.imgur.com/nzOon.jpg

这可能吗?多年来一直致力于此,但我的想法已经用完了。

谢谢!

JS:

<script type="text/javascript" charset="utf-8">
    $(function(){
            $(".image").wrap("<td>");
    });
</script>   

CSS:

.image {
position:absolute;
width:auto;
height:100%;
}   

HTML:

<div id="page-wrap">
         <div class="image">
              <img src="images/Betty-001.jpg" id="image-contents" />  
         </div>

         <div class="image" style="margin-left:75%;">
               <img src="images/Betty-001.jpg" id="image-contents" />  
         </div>             
</div>

最佳答案

如果您允许,HTML 将为您完成滚动和图像宽度。

演示:http://jsfiddle.net/ThinkingStiff/sVa7S/

HTML:

<div id="scroll">
       <img src="http://thinkingstiff.com/images/priorities.png" /><!--
    --><img src="http://thinkingstiff.com/images/priorities.png" />
</div>

CSS:

#scroll {
    height: 100%;
    overflow-x: scroll;    
    white-space: nowrap;
    width: 100%;
}

#scroll img {
    height: 100%;
    vertical-align: top;
}

关于css - 水平滚动页面上 100% 宽度的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10964170/

相关文章:

javascript - 我如何转动这个每日图像代码来按天但在固定时间而不是午夜更改图像

CSS 布局 - 动态宽度 DIV

html - 如何删除网页底部的空白区域?

jquery - 选择奇数和偶数元素

iphone - CVPixelBufferLockBaseAddress 为什么?使用 AVFoundation 捕获静态图像

HTML/CSS 相同的 div 长度

html固定宽度和动态布局

javascript - 滚动条上的垂直 slider

HTML & CSS : create a checkbox without using 'checkbox'

vba - 在word中选择粘贴的图片