$(function(){
$(".search-submit").click(function(event){
$(this).removeAttr("name");
event.preventDefault();
var val = $.trim($(".search-title").val());
if(val!==""){
$(".wp-search").find("form").submit();
}else{
alert("请输入关键词");
}
return false;
});
$(".sear_btn").click(function () {
$(".searchbox").addClass("open");
});
$(".closed").click(function () {
$(this).parents(".fixbox").removeClass("open");
});
$(".wp-menu li").each(function(){
if($(this).children().length>1){
$(this).addClass("have")
}
});
/*媒体链接*/
$(".shares li").each(function(){
$(this).children("a").hover(function(){
$(this).parent().find(".con").stop(true,true).fadeIn();
},function(){
$(this).parent().find(".con").stop(true,true).fadeOut();
});
});
//导航图片
var articleUrl = "/_wp3services/generalQuery?queryObj=articles";
var siteId = 2; //站点Id
var columnId =11614; //多个以英文逗号分隔
var pageIndex = 1; //从某页开始
var rows =10; //每页显示多少篇文章
var text = "";
loadContents(pageIndex,columnId,siteId,rows);
function loadContents(pageIndex,columnId,siteId,rows){
//排序参数
var orderData = [
];
var returnInfos = JSON.stringify(returnData());
var orders = JSON.stringify(orderData);
var conditions = JSON.stringify(conditData(text));
$.ajax({
url: articleUrl,
type: 'POST',
contentType: "application/x-www-form-urlencoded; charset=utf-8",
async: false,
dataType: 'json',
data: {
siteId:siteId,
columnId:columnId,
pageIndex:pageIndex,
rows: rows,
orders:orders,
returnInfos: returnInfos,
conditions:conditions
//visitPermitFilter:1
},
success: function(result){
var total = result.total;
if (result != null){
for (j=0;j < result.data.length; j++){
var art = result.data[j];
$(".wp-menu .menu-item").each(function(){
if($(this).find(".menu-link").text()==art.title){
console.log($(this).find(".menu-link").text());
$(this).find(".pic").append('
');
$(this).find(".txt").append(''+art.summary+'');
}
})
}
}
}
});
}
/*查询条件*/
function conditData(val){
var conditdata = [
//{field: "title", value: val, judge: "like"},
{field: "scope", value: 0, judge: "="}
];
return conditdata;
}
//请求返回参数
function returnData(){
var returnInfosdata = [
{field: "title",pattern: [{name: "lp",value: "30"}], name: "title"},
{field: "imgPath",name: "imgPath"},
{field: "summary",name: "summary"},
];
return returnInfosdata;
}
//slick左右轮播
$('.foot-left .news_list').slick({
dots: true, //指示点
infinite: true, //循环播放
autoplay: true, //自动播放
autoplaySpeed: 5000, //自动播放间隔
pauseOnHover: false, //鼠标悬停暂停自动播放
swipeToSlide: true, //允许用户直接拖动或滑动到幻灯片上
draggable: true,
arrows: false, //左右箭头
useCSS: true, //使用 CSS3 过度
speed: 1000, //滑动时间
vertical: false, //是否开启垂直滑动模式
verticalSwiping: false, //是否开启垂直滑动切换
slidesToShow: 1, //幻灯片每屏显示个数
slidesToScroll: 1, //幻灯片每次滑动个数
rows:2,
slidesPerRow:2,
touchMove:true,//可否拖动1
swipe:true,//可否拖动2
centerMode: false,//中心模式
variableWidth: false,//可变宽度
adaptiveHeight: true,//适应高度
});
});