简体   繁体   English

水平滑动div内容并超过窗口限制

[英]Horizontally slide div content and exceed window limit

I have the following code with two DIVs floating to right: 我有以下代码,其中两个DIV浮动在右边:

<div class="sample1"></div>
<div class="sample2"></div>

CSS: CSS:

.sample1,
.sample2 {
    height: 50vh;
    float: right;
    width: 50%;
}

Div "sample1" will get its width bigger by jQuery on a click event. jQuery在单击事件时,div“ sample1”的宽度将变大。 Div "sample2" will break down, because it will exceed the window limit. Div“ sample2”将崩溃,因为它将超过窗口限制。 What I need is to push "sample2" without breaking it down. 我需要推动“ sample2”而不分解它。

Any ideas about how is it possible with CSS only solutions? 关于仅CSS解决方案怎么可能的任何想法?

Try using: 尝试使用:

overflow-x:scroll;

As described here: http://www.w3schools.com/cssref/css3_pr_overflow-x.asp 如此处所述: http : //www.w3schools.com/cssref/css3_pr_overflow-x.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM