console
$(()=>{
var h = $('body').height();
$('.app-body-bg').height(h);
$('.app-body-footer').css('top',h+'px');
var list = $('#list');
list.html((()=>{
var html = '';
for(var i=0; i< 100; i++){
html += '<li>jkjkkk</li>';
}
return html;
})());
$('#list2').html((()=>{
var html = '';
for(var i=0; i< 100; i++){
html += '<li>jkjkkk'+i+'</li>';
}
return html;
})());
$(document).scroll(()=>{
var top = $(this).scrollTop();
console.log(top+'px');
if (top == 0) {
if (list.hasClass('app-hide')) {
list.show();
list.removeClass('app-hide');
}
}else {
if (!list.hasClass('app-hide')) {
list.hide();
list.addClass('app-hide');
}
}
});
})
<body>
<div class="app-body-bg">
<div class="app-body">
<div class="app-body-scroll">
<ul id="list">
<li>jkjkkk</li>
</ul>
</div>
</div>
<div class="app-footer">
<div class="app-panel">
app-footer
</div>
</div>
<div class="app-body-footer">
<div class="app-panel">
<ul id="list2">
<li>jkjkkk</li>
</ul>
</div>
</div>
</div>
</body>
:root {
--bodyBg: rgb(84, 171, 230);
--borderRadius: 30px;
}
html,body{
height: 100%;
margin: 0;
padding: 0;
}
body{
background-color: var(--bodyBg);
}
.app-body,
.app-body-bg,
.app-footer,
.app-body-footer{
position: absolute;
left: 0;
right: 0;
}
.app-body,
.app-footer,
.app-body-footer{
padding: 0 5vw;
}
.app-body{
top: 0;
padding-bottom: 110px;
height: 100%;
overflow: hidden;
box-sizing: border-box;
}
.app-body>.app-body-scroll{
width: calc(100% + 17px);
height: 100%;
overflow-y: auto;
}
.app-hide{
display: none !important;
}
.app-footer{
bottom: 0;
height: 100px;
}
.app-body-footer{
top: 100%;
height: auto;
}
.app-body-bg{
top: 0;
height: 100%;
background-size: 100%;
background-repeat: no-repeat;
background: linear-gradient(180deg, rgb(4, 4, 73), rgb(245, 241, 223), var(--bodyBg));
}
.app-footer .app-panel,
.app-body-footer .app-panel{
padding: 1vw 10vw;
color: balck;
background-color: white;
}
.app-footer>.app-panel{
height: 100%;
border-top-left-radius: var(--borderRadius);
border-top-right-radius: var(--borderRadius);
border-bottom: 1px solid black;
}
.app-body-footer .app-panel{
border-bottom-left-radius: var(--borderRadius);
border-bottom-right-radius: var(--borderRadius);
margin-bottom: 10px;
}
#list {
text-align: center;
}