// //导航移动 demo示例六 通过id调取
$('#demo06').navbarscroll({
defaultSelect: 0 , //默认选中
scrollerWidth:4,
fingerClick:1,
endClickScroll:function(obj){
// console.log(obj.text())
}
});
var idData = ""; // 导航类型ID
var listId = 0; //资讯id
$('.m_click li').on('click',function(){ // 导航切换
var idSwitch = $(this).attr('switch');
$(this).attr('id','cur').siblings().attr('id','');
switch(idSwitch) // 切换判断
{
case 'false':
$('.m_notice_list_box').show();
$(this).attr('switch','true').siblings().attr('switch','false');
$('.m_albumtnav_zhez').show();
break;
case 'true':
$('.m_notice_list_box').hide();
$(this).attr('switch','false');
$('.m_albumtnav_zhez').hide();
break;
}
idData = $(this).attr('dataid'); // 获取类型ID
ajax_list(); // 导航列表数据
})
$('.m_albumtnav_zhez').on('click',function(){ // 遮罩层
$(this).hide();
$('.m_notice_list_box').hide();
$('.m_click li').attr('switch','false');
})
AjaxFn(); //资讯列表数据
function ajax_list(){ // 导航列表数据
var html = '';
$.ajax({
url: "/knowledgebase/getnav",
data:{id:idData},
type: "GET",
dataType: "json",
success: function(data) {//请求成功完成后要执行的方法
$.each(data.data, function (i, data) { //左边楼盘列表
html+='
'+data.name+'';
});
$(".m_notice_list_box ul").html(html);
$('.m_notice_list_box ul li').on('click',function(){ //导航列表
$('.m_zx_list_box ul').html(""); //切换内容之前先清空盒子
$('.m_albumtnav_zhez').hide();
$('.m_notice_list_box').hide();
$('.m_click li').attr('switch','false');
listId = $(this).attr('zxid');
// console.log(listId);
AjaxFn(); //资讯列表数据
})
}
});
}
// 报名窗口
var w_li ='';
w_li +='';
w_li +='';
w_li +='
';
function AjaxFn(){ //资讯列表数据
page = 0;
size = 10;
page++;
$.ajax({
type: 'GET',
url: '/knowledgebase/getlist?&page='+page+'&limit='+size+'&id='+listId,
// url: '/knowledgebase/getlist'+txt+'&page='+page+'&limit='+size,
dataType: 'json',
success: function(data){
// if(data.code == 200){
$('.m_zx_list_box ul').append(ModuleWay(data)) //调用选择模块
// 报名窗口插入
var on_off = true;
if(on_off){
$('.m_zx_list_box ul li').eq(3).after(w_li)
on_off = false;
}
fun(); // 上滑加载
// }
// console.log(data.data);
// 每次数据加载完,必须重置
// me.resetload();
},
error: function(xhr, type){
// alert('Ajax error!');
// 即使加载出错,也得重置
// me.resetload();
}
});
// 上滑加载
// $('.news_list').dropload({
// // 调用加载
// scrollArea : window,
// threshold:2/3,
// loadDownFn : function(me){
//
// }
// });
}
// 选择各个模块
function ModuleWay(data){
var html ="";
$.each(data.data, function (i, data) { //左边楼盘列表
html+='';
html+='';
html+='';
html+='';
html+='
'+data.subject+'';
html+='
'+data.name+'
';
html+='
';
html+='';
html+='';
})
return html ;
}
function fun(){
// 上滑加载
$('.m_zx_list_box').dropload({
// 调用加载
scrollArea : window,
// threshold:2/3,
loadDownFn : function(me){
page++;
// $('.dropload-down').show();
$.ajax({
type: 'GET',
url: '/knowledgebase/getlist?&page='+page+'&limit='+size+'&id='+listId,
// url: '/knowledgebase/getlist?&page='+page+'&limit='+size + '&id='+zxId,
dataType: 'json',
success: function(data){
// console.log(data);
if(data.code == 200){
$('.m_zx_list_box ul').append(ModuleWay(data)) //调用选择模块
}else{
// 锁定
me.lock();
// 无数据
me.noData();
// me.resetload();
}
// alert(data);
// 每次数据加载完,必须重置
setTimeout(function(){
// 插入数据到页面,放到最后面
// $('.m_category_zx_box').append(result);
// 每次数据插入,必须重置
me.resetload();
},500);
$('.dropload-down').eq(0).show().siblings('.dropload-down').remove();
},
error: function(xhr, type){
// alert('Ajax error!');
// 即使加载出错,也得重置
// me.resetload();
}
});
}
});
$(window).scroll(function(){
$('.m_notice_list_box').hide();
$('.m_albumtnav_zhez').hide();
$('.m_click li').attr('switch','false');
})
}