gpt4 book ai didi

jquery - 使文本列表保持在页脚上方,但能够将它们滚动到撰写栏下方

转载 作者:行者123 更新时间:2023-11-28 15:21:18 25 4
gpt4 key购买 nike

我正在尝试滚动消息列表,使其位于撰写栏下方,但是当添加新消息时,它们应该添加到撰写栏的正上方。有关我的意思的快速演示,请参阅此 link 中的图片.

我的问题:

  • 我无法根据内容大小控制内部 div 元素的宽度。

  • 无法正确获得所需的滚动条(如图所示)

.contentContainer {
margin: 0;
padding: 0;
margin-top: 68px;
height: calc(100vh - 68px);
display: block;
overflow-y: auto;
}

.content {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
height: inherit;
}

.messageArea {
flex-grow: 1;
/*min-width: 400px;*/
height: inherit;
position: relative;
}

.scrollingMessagesList {
height: inherit;
overflow-x: hidden;
overflow-y: auto;
transform: translateZ(0);
}

.outer {
margin: 0 auto;
margin-top: 18px;
margin-bottom: 142px;
height: 414px;
position: relative;
background-color: #78909c;
}

.inner {
margin: 0 20px;
height: inherit;
background-color: darkkhaki;
display: flex;
flex-direction: column-reverse;
align-items: flex-end;
}

.inner p {
width: auto;
max-width: 100%;
outline: none;
padding-bottom: 2px;
background-color: greenyellow;
}

.composeBar {
z-index: 1029!important;
border: none;
bottom: 20px;
}

.compose {
height: 52px;
border-radius: 26px;
background-color: white;
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, .16), 0 4px 4px 0 rgba(0, 0, 0, .10), 0 3px 3px 0 rgba(0, 0, 0, .08);
;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid contentContainer" style="background-color: blanchedalmond;">
<div class="content">
<div class="messageArea">
<div class="scrollingMessagesList">
<div class="outer">
<div class="inner">
<p>Text 1</p>
<p>Text 2</p>
<p>Text 3</p>
</div>
</div>
</div>
<div class="composeBar navbar-fixed-bottom">
<div class="compose">
</div>
</div>
</div>
</div>
</div>

最佳答案

在这里,您可以检查我是否更新了您的代码,如果觉得有帮助,请查看。

$(document).ready(function() {
function setHeight() {
windowHeight = $(window).outerHeight();
$('.inner').css('min-height', windowHeight - 68);
};
setHeight();

$(window).resize(function() {
setHeight();
});
});
.contentContainer {
margin: 0;
padding: 0;
display: block;
overflow-y: auto;
margin-top: 68px;
height: calc(100vh - 68px);
}

.content {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
height: inherit;
}

.messageArea {
flex-grow: 1;
/*min-width: 400px;*/
height: inherit;
position: relative;
}

.scrollingMessagesList {
height: inherit;
overflow-x: hidden;
overflow-y: auto;
transform: translateZ(0);
}

.outer {
margin: 0 auto;
position: relative;
background-color: #78909c;
}

.inner {
margin: 0 20px;
height: auto;
background-color: darkkhaki;
display: flex;
flex-direction: column;
justify-content: flex-end;
padding-bottom: 60px;
align-items: flex-end;
}

.inner p {
width: auto;
max-width: 100%;
outline: none;
padding-bottom: 2px;
background-color: greenyellow;

}

.composeBar {
z-index: 1029!important;
border: none;
bottom: 5px !important;
position: fixed;
}


.compose {
height: 52px;
border-radius: 26px;
background-color: white;
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, .16), 0 4px 4px 0 rgba(0, 0, 0, .10), 0 3px 3px 0 rgba(0, 0, 0, .08);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid contentContainer" style="background-color: blanchedalmond;">
<div class="content">
<div class="messageArea">
<div class="scrollingMessagesList">
<div class="outer">
<div class="inner">
<p>Text 1</p>
<p>Text 2</p>
<p>Text 3</p>
<p>Text 4</p>
<p>Text 5</p>
<p>Text 6</p>
<p>Text 7</p>
<p>Text 7</p>
</div>
</div>
</div>
<div class="composeBar navbar-fixed-bottom">
<div class="compose">
</div>
</div>
</div>
</div>
</div>

关于jquery - 使文本列表保持在页脚上方,但能够将它们滚动到撰写栏下方,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46068316/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com