如何缩放此布局?

INT*_*INT 14 html javascript css position scale

我已经在这个布局上工作了一段时间,每一次我都遇到了某种障碍(这里的v1:https://stackoverflow.com/questions/14572569/how-can-i-contain-pos-abs -div-within-specific-area)

我现在要做的是使.spread的大小适应浏览器窗口的宽度和高度,所以它永远不会超过用户目前在浏览器中看到的内容(.spread目前有固定的宽度/高度,用于演示目的).理想的是能够即时调整大小并立即适应(即没有媒体查询).

它在我链接到上面的v1版本中应该工作,但是由于那个.spread缺乏实际的宽度/高度,因此我遇到了淡入淡出效果的问题.

这是新的演示:http:
//jsbin.com/uciguf/1

更新:只要符号如上所述,就可以更改标记.

<div class="scrollblock" id="scroll_spread-1">
    <div class="action"><!-- --></div>
    <!--  -->       
</div>
<div class="scrollblock" id="scroll_spread-2">
    <div class="action"><!-- --></div>
    <!--  -->       
</div>

<div class="contentblock" id="spread-1">
    <div class="inner windowwidth windowheight">
        <div class="content">
            <span></span>
            <div class="spread">
                <div class="fade"><!-- --></div>
                <div class="left centerimage">
                    <img src="http://s7.postimage.org/8qnf5rmyz/image.jpg">
                </div>
                <div class="right centerimage">
                    <a href="#scroll_spread-2"><img src="http://s7.postimage.org/kjl89zjez/image.jpg"></a>
                </div>
            </div>  
        </div>  
    </div>  
</div>

<div class="contentblock" id="spread-2">
    <div class="inner windowwidth windowheight">
        <div class="content">
            <span></span>           
            <div class="spread">
                <div class="fade"><!-- --></div>
                <div class="left centerimage">
                    <a href="#scroll_spread-1"><img src="http://s7.postimage.org/5l2tfk4cr/image.jpg"></a>
                </div>
                <div class="right centerimage">
                    <a href="#scroll_spread-3"><img src="http://s7.postimage.org/fjns21dsb/image.jpg"></a>
                </div>
            </div>
        </div>  
    </div>  
</div>
Run Code Online (Sandbox Code Playgroud)

 

html {
    height: 100%;
}

body {
    background: #eee;
    line-height: 1.2em;
    font-size: 29px;
    text-align: center;
    height: 100%;
    color: #fff;
}

.scrollblock {
    position: relative;
    margin: 0;
    width: 100%;
    min-height: 100%;

    overflow: hidden;
}

.contentblock {
    margin: 0;
    width: 0;
    min-height: 100%;

    overflow: hidden;

    position: fixed;
    top: 0;
    right: 0;
}

.contentblock .inner {
    z-index: 2;

    position: absolute;
    right: 0;
    top: 0;

    background: #eee;
}

.fade {
    width: 100%;
    height: 100%;

    position: absolute;
    right: 0;
    top: 0;

    background-color: #000;
    opacity: 0;

    z-index: 3;
}

.content {
    height: 100%;   
}

.content span {
   height: 100%;
   vertical-align: middle;
   display: inline-block;
}

.content .spread {
    vertical-align: middle;
    display: inline-block;
}

#spread-1 {
    color: #000;
    z-index: 105;
}

#spread-2 {
    z-index: 110;
}

.spread {

    max-height: 800px;
    max-width: 1130px;
    position: relative;
}

.spread .left {
    position: relative;
    width: 50%;
    float: left;
    text-align: right;
    height: 100%;
}
.spread .right {
    position: relative;
    width: 50%;
    float: left;
    text-align: left;
    height: 100%;
}

div.centerimage {
    overflow: hidden;
}
div.centerimage img {
    max-width: 100%;
    max-height: 100%;
}

div.centerimage span {
    height: 100%;
    vertical-align: middle;
    display: inline-block;
}
div.centerimage img {
    vertical-align: middle;
    display: inline-block; 
}
Run Code Online (Sandbox Code Playgroud)

PS标题非常糟糕,不知道我在寻找什么,但如果你能想到更好的东西,请转到更有用的东西.

Sco*_*ttS 4

完整解决方案已完成四分之三

这还不是一个完整的解决方案,因为它无法容纳超窄宽度的窗口尺寸(就像您的旧版本那样)。然而,这是朝着您所追求的目标迈出的良好一步。

这是一个例子。

已更改的关键内容:

添加

.spread { height: 93%; } /* You had originally wanted a height difference */
Run Code Online (Sandbox Code Playgroud)

已删除

  • overflow: hiddendiv.centerimage
  • width: 50%.left.right