$(document).ready(function(){
if ($("#banner").length>0){
$("#banner").Slide_zhy({
fullscreen :true,
arrow :true,
speed: 1200,
space: 6000,
animate:true,
auto: 5000, //自动滚动
affect:'fade_animate',
loading:true,
autoheight:true,
bg_show:true,
ctag: '.Slide_'
})
}
if ($("#TeacherContent").length>0){
var top = $("#TeacherContent").position().top
$("#ContentNav").Floatingbar({top:top,bottom:264});
}
$("#wp_news_w50").picShowGundong()
})
$.fn.picShowGundong = function(){
var $wp_news_w50 = $('#wp_news_w50')
if ($wp_news_w50.length===0){return false;}
$wp_news_w50.append('
')
$wp_news_w50.attr("data-setting",'{"width":1200,"height":270,"posterWidth":300,"posterHeight":350,"scale":0.85,"dealy":"2000","algin":"middle"}')
Caroursel.init($wp_news_w50)
}
//浮动 限位
$.fn.Floatingbar=function(config){
var self=this
if (self.length==0 || typeof config!="object"){return;}
var window_h = $(window).height(),
window_center = window_h/2,
document_h = $(document).outerHeight(),
self_height = self.outerHeight(),
offsetTop = self.offset().top,
offsetBom = document_h-config.bottom,
list = [];
var $navli = self.find("li")
$navli.find("a").bind("click",function(){
var href= $(this).data('wz')
var top = $('[name="'+href+'"]').offset().top;
$("html,body").animate({scrollTop:top},1000)
return false;
})
$navli.each(function(){
var href=$(this).find('a').data("wz").replace("#",'')
var wz = $("a[name='"+href+"']")
var more = wz.parent().next().find(">a"),
moreurl = ''
if (more.length===1){
moreurl = more.attr("href")
more.parent().load(moreurl+" #docContent .wp_articlecontent",function(){});
}
list.push(parseInt($("a[name='"+href+"']").offset().top )-16)
})
console.log("list",list)
$(window).bind("resize.floating",function(){
console.log("aaa")
window_h = $(window).height();
window_center = window_h/2;
})
$(window).bind("scroll.floating",function(){
var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;
var newvalue=config.top-scrollTop,
newvalue2= scrollTop+self_height
list.forEach(function(item,index){
var next = index+1
//最后一个
if (next<=list.length){
if (scrollTop>item && scrollTop=offsetTop){
if (newvalue2>=offsetBom ){
self.css({"position":"fixed",'top':-(newvalue2-offsetBom)})
}else{
self.css({"position":"fixed",'top':0})
}
}else if (scrollTop