100 lines
3.1 KiB
HTML
100 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Document</title>
|
||
<link rel="stylesheet" href="./css/clear.css">
|
||
<link rel="stylesheet" href="./css/public.css">
|
||
<link rel="stylesheet" href="./css/index.css">
|
||
|
||
</head>
|
||
<body>
|
||
<ul>
|
||
</ul>
|
||
</body>
|
||
<script src="./js/ajax.js"></script>
|
||
<script src="./js/utils.js"></script>
|
||
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js"></script>
|
||
<script src="./js/index.js"></script>
|
||
<script>
|
||
var ul = document.querySelector("ul");
|
||
var page = '';
|
||
|
||
function getData() {
|
||
http({
|
||
url: 'http://127.0.0.1:3000/api/list',
|
||
method: 'GET',
|
||
data: {
|
||
page: page
|
||
},
|
||
success: function (res) {
|
||
page = res.data.pcursor
|
||
AppendUl(res.data)
|
||
}
|
||
})
|
||
}
|
||
|
||
function AppendUl(res) {
|
||
console.log(page)
|
||
res.list.forEach((val,index)=>{
|
||
ul.innerHTML+= `
|
||
<li>
|
||
<div class="toubu">
|
||
<div class="mohu" style="background: url(${val.thumbnailUrl});"></div>
|
||
<img src="${val.thumbnailUrl}" alt="">
|
||
</div>
|
||
<div class="bottom">
|
||
<div class="toux">
|
||
<a href="">
|
||
<img src="${val.user.avatar}" alt="">
|
||
<span>${val.user.name}</span>
|
||
</a>
|
||
</div>
|
||
<div class="dzsc">
|
||
<a class="down" href="">下载</a>
|
||
<a class="play" href="./play.html?uid=${val.user.id}&vid=${val.id}">播放</a>
|
||
</div>
|
||
</div>
|
||
</li>
|
||
`
|
||
})
|
||
}
|
||
|
||
getData()
|
||
|
||
$(document).ready(function (){
|
||
var nScrollHight = 0; //滚动距离总长(注意不是滚动条的长度)
|
||
var nScrollTop = 0; //滚动到的当前位置
|
||
var nDivHight = $("#div1").height();
|
||
$("#div1").scroll(function(){
|
||
nScrollHight = $(this)[0].scrollHeight;
|
||
nScrollTop = $(this)[0].scrollTop;
|
||
var paddingBottom = parseInt( $(this).css('padding-bottom') ),paddingTop = parseInt( $(this).css('padding-top') );
|
||
if(nScrollTop + paddingBottom + paddingTop + nDivHight >= nScrollHight)
|
||
alert("滚动条到底部了");
|
||
});
|
||
});
|
||
|
||
</script>
|
||
</html>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<!-- <script language="javascript">
|
||
$(document).ready(function (){
|
||
var nScrollHight = 0; //滚动距离总长(注意不是滚动条的长度)
|
||
var nScrollTop = 0; //滚动到的当前位置
|
||
var nDivHight = $("#div1").height();
|
||
$("#div1").scroll(function(){
|
||
nScrollHight = $(this)[0].scrollHeight;
|
||
nScrollTop = $(this)[0].scrollTop;
|
||
var paddingBottom = parseInt( $(this).css('padding-bottom') ),paddingTop = parseInt( $(this).css('padding-top') );
|
||
if(nScrollTop + paddingBottom + paddingTop + nDivHight >= nScrollHight)
|
||
alert("滚动条到底部了");
|
||
});
|
||
});
|
||
</script> --> |