Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/408.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使文本流向下一行,并隐藏顶部?_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 如何使文本流向下一行,并隐藏顶部?

Javascript 如何使文本流向下一行,并隐藏顶部?,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我正在处理计算器的显示部分。我有一个div,里面有两个div,每个div都有文本 <div> <div>I'm text</div> <div>I'm text</div> </div> Codepen:“我还没有找到CSS/HTML解决方案的答案。但是,我转向jQuery/JavaScript,在每次更新#内存分区后调用下面的函数,解决了我的问题 function heightCheck(str) { co

我正在处理计算器的显示部分。我有一个div,里面有两个div,每个div都有文本

<div>
<div>I'm text</div>
<div>I'm text</div>
</div>

Codepen:“

我还没有找到CSS/HTML解决方案的答案。但是,我转向jQuery/JavaScript,在每次更新#内存分区后调用下面的函数,解决了我的问题

function heightCheck(str) {

      console.log(str.substr(1));
      console.log('memory: ' + $("#memory").height());
      while ($("#memory").height()>30) {
            str=str.substr(1);
            $("#memory").text(str);
            console.log(str);
            console.log($("#memory").height());
      }

}
对#内存块的此更改导致:

添加了显示:柔性柔性流:列反向

#memory{
     font-size: 15px;
     padding-right: 3px;
     line-height: 15px;
     margin-top: 5px;
     padding-left: 12px;
     color: #767676;
     margin-bottom: -7px;
     word-wrap: break-word;
     height: 30px;
     width: 207px;
     overflow: hidden;
     display: flex;
     flex-flow: column-reverse;
}
function heightCheck(str) {

      console.log(str.substr(1));
      console.log('memory: ' + $("#memory").height());
      while ($("#memory").height()>30) {
            str=str.substr(1);
            $("#memory").text(str);
            console.log(str);
            console.log($("#memory").height());
      }

}
#memory{
     font-size: 15px;
     padding-right: 3px;
     line-height: 15px;
     margin-top: 5px;
     padding-left: 12px;
     color: #767676;
     margin-bottom: -7px;
     word-wrap: break-word;
     height: 30px;
     width: 207px;
     overflow: hidden;
     display: flex;
     flex-flow: column-reverse;
}