方法一:
body{
font-size: 0.16rem;
}
li{
height: 2rem;
display: flex;
align-items: center;
justify-content: center;
list-style: none;
}
.disnone{
display: none;
}
.padd-g {
padding: 0.1rem 0;
}
#qiehuan .button {
font-size: 0.18rem;
border-bottom: 0.01rem solid #50D7ED;
color: white;
}
#qiehuan .wubutton {
font-size: 0.14rem;
border: 0;
color: #A0A0A0;
}
#qiehuan{
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 0.4rem;
background: black;
}
#zuixing{
font-size:0.14rem;
color: #CCCCCC;
margin-left: 0.55rem;
}
.fixed {
position: fixed;
top: 0;
z-index: 100;
width: 100%;
background: #000000;
}
推荐
最新
- sede1
- sede2
- sede3
- sede4
- sede5
- sede6
- sede7
- sede8
- sede9
- sede11
- sede22
- sede33
- sede44
- sede55
- sede66
- sede77
- sede88
- sede99
function resetWidth() {
// 兼容ie浏览器 document.body.clientWidth
var baseWidth = document.documentElement.clientWidth || document.body.clientWidth;
// console.log(baseWidth);
// 默认的设置是375px(ip6)的根元素设为100px, 其他的手机都相对这个进行调整
document.documentElement.style.fontSize = baseWidth / 375 * 100 + 'px'
}
resetWidth();
window.addEventListener('resize', function () {
resetWidth();
})
// 推荐和最新切换
$("#qiehuan").on("click","#tuanjian,#zuixing",function(){
document.documentElement.scrollTo(0,0)
for(var i=0; i<$("#qiehuan").children().length; i++){
$($("#qiehuan").children()[i]).addClass("wubutton")
$($("#qiehuan").children()[i]).removeClass("button")
}
$(this).addClass("button")
$(this).removeClass("wubutton")
$(".list").toggleClass("disnone");
$(".list2").toggleClass("disnone");
if(end == 2 && $(this).prop("class")=="disnone"){
end = 1;
}
})
//下拉加载更多
var times = 1;
var times2 = 1;
var end = 1;
var end2 = 1;
var flexd = 1;
$(document).scroll(function(){
var tops = $(document).scrollTop();
var height = $(document).height();
var offsetHeight = $(window).height();
// console.log('tops',tops,'height',height,'offsetHeight',offsetHeight);
if(tops >320 && flexd==1){
flexd = 0
$("#qiehuan").addClass("fixed")
}
if(tops < 320 && flexd==0){
flexd = 1
$("#qiehuan").removeClass("fixed")
}
if(tops+offsetHeight if(end==2){ end=1 }else if(end2==2){ end2=1 } } // 下拉加载 if(tops + offsetHeight > height - 100 && end ==1 && $(".list2").attr("class") =="list2 disnone"){ var htmlstr = "" end = 0 if(times<5){ for (m = 0; m < 10; m++) { htmlstr +=`
}
$(".list").append(htmlstr)
times++
end=2
}else{
alert("没有更多了")
end = 2
}
}
if(tops + offsetHeight > height - 100 && end2 ==1 && $(".list").attr("class") =="list disnone"){
var htmlstr = ""
end2 = 0
if(times2<5){
for (m = 0; m < 10; m++) {
htmlstr +=`
}
$(".list2").append(htmlstr)
times2++
end2=2
}else{
alert("没有更多了")
end2 = 2
}
}
})
方法二:
var list1pagenum =1;
var list2pagenum =1;
var userid = getUserid();
//下拉加载更多
-
6666666
最热
最新
$(function(){
getlist(list2pagenum,1);
getlist(list1pagenum,0);
})
refresher.init({
id:"wrapper",
pullDownAction:Refresh,
pullUpAction:Load
})
function Refresh(){
//Action.loading(true);
wrapper.refresh();
}
function Load(){
//Action.loading(true);
if($('#detaliList1').hasClass('disnone')){
getlist(list2pagenum,1);
}else {
getlist(list1pagenum,0);
}
}