Team:XJTLU-CHINA/App/js

$(document).ready(function(){


   $(function(){
       $(window).scroll(function(){
           height = $(window).scrollTop();
           if(height > 683){
               $('.Zheader').fadeIn();
           }else{
               $('.Zheader').fadeOut();
           };
       });
   });


   $(".mainNavi").hover(function(){
       $(this).children("ul").slideDown(50);
   },function(){
       $(this).children("ul").slideUp(100);
   },function(){
   });


   $("#PrimaryNaviBg1").hover(function(){
       $("#PrimaryNaviBg1").css("background-color","#3399CC");
   },function(){
       $("#PrimaryNaviBg1").css("background-color","");
   });
   $("#PrimaryNaviBg2").hover(function(){
       $("#PrimaryNaviBg2").css("background-color","#3399CC");
   },function(){
       $("#PrimaryNaviBg2").css("background-color","");
   });
   $("#PrimaryNaviBg3").hover(function(){
       $("#PrimaryNaviBg3").css("background-color","#3399CC");
   },function(){
       $("#PrimaryNaviBg3").css("background-color","");
   });
   $("#PrimaryNaviBg4").hover(function(){
       $("#PrimaryNaviBg4").css("background-color","#3399CC");
   },function(){
       $("#PrimaryNaviBg4").css("background-color","");
   });
   $("#PrimaryNaviBg5").hover(function(){
       $("#PrimaryNaviBg5").css("background-color","#3399CC");
   },function(){
       $("#PrimaryNaviBg5").css("background-color","");
   });
   $("#PrimaryNaviBg6").hover(function(){
       $("#PrimaryNaviBg6").css("background-color","#3399CC");
   },function(){
       $("#PrimaryNaviBg6").css("background-color","");
   });
   $("#PrimaryNaviBg7").hover(function(){
       $("#PrimaryNaviBg7").css("background-color","#3399CC");
   },function(){
       $("#PrimaryNaviBg7").css("background-color","");
   });
   $("#PrimaryNaviBg8").hover(function(){
       $("#PrimaryNaviBg8").css("background-color","#3399CC");
   },function(){
       $("#PrimaryNaviBg8").css("background-color","");
   });
   $("#PrimaryNaviBg9").hover(function(){
       $("#PrimaryNaviBg9").css("background-color","#3399CC");
   },function(){
       $("#PrimaryNaviBg9").css("background-color","");
   });


   $(".ZmainNavi").hover(function(){
       $(this).children("ul").slideDown(50);
   },function(){
       $(this).children("ul").slideUp(100);
   },function(){
   });
   $("#ZPrimaryNaviBg1").hover(function(){
       $("#ZPrimaryNaviBg1").css("background-color","#3399CC");
   },function(){
       $("#ZPrimaryNaviBg1").css("background-color","");
   });
   $("#ZPrimaryNaviBg2").hover(function(){
       $("#ZPrimaryNaviBg2").css("background-color","#3399CC");
   },function(){
       $("#ZPrimaryNaviBg2").css("background-color","");
   });
   $("#ZPrimaryNaviBg3").hover(function(){
       $("#ZPrimaryNaviBg3").css("background-color","#3399CC");
   },function(){
       $("#ZPrimaryNaviBg3").css("background-color","");
   });
   $("#ZPrimaryNaviBg4").hover(function(){
       $("#ZPrimaryNaviBg4").css("background-color","#3399CC");
   },function(){
       $("#ZPrimaryNaviBg4").css("background-color","");
   });
   $("#ZPrimaryNaviBg5").hover(function(){
       $("#ZPrimaryNaviBg5").css("background-color","#3399CC");
   },function(){
       $("#ZPrimaryNaviBg5").css("background-color","");
   });
   $("#ZPrimaryNaviBg6").hover(function(){
       $("#ZPrimaryNaviBg6").css("background-color","#3399CC");
   },function(){
       $("#ZPrimaryNaviBg6").css("background-color","");
   });
   $("#ZPrimaryNaviBg7").hover(function(){
       $("#ZPrimaryNaviBg7").css("background-color","#3399CC");
   },function(){
       $("#ZPrimaryNaviBg7").css("background-color","");
   });
   $("#ZPrimaryNaviBg8").hover(function(){
       $("#ZPrimaryNaviBg8").css("background-color","#3399CC");
   },function(){
       $("#ZPrimaryNaviBg8").css("background-color","");
   });
   $("#ZPrimaryNaviBg9").hover(function(){
       $("#ZPrimaryNaviBg9").css("background-color","#3399CC");
   },function(){
       $("#ZPrimaryNaviBg9").css("background-color","");
   });


   $(".jump1").anchorGoWhere({target:1});
   $(".jump2").anchorGoWhere({target:1});
   $(".jump3").anchorGoWhere({target:1});
   $(".jump4").anchorGoWhere({target:1});
   $(".jump5").anchorGoWhere({target:1});
   $(".jump6").anchorGoWhere({target:1});
   $(".jump7").anchorGoWhere({target:1});

});

jQuery.fn.anchorGoWhere = function(options){

   var obj = jQuery(this);
   var defaults = {target:0, timer:1000};
   var o = jQuery.extend(defaults,options);
   obj.each(function(i){
       jQuery(obj[i]).click(function(){
           var _rel = jQuery(this).attr("href").substr(1);
           switch(o.target){
               case 1:
                   var _targetTop = jQuery("#"+_rel).offset().top;
                   jQuery("html,body").animate({scrollTop:_targetTop},o.timer);
                   break;
               case 2:
                   var _targetLeft = jQuery("#"+_rel).offset().left;
                   jQuery("html,body").animate({scrollLeft:_targetLeft},o.timer);
                   break;
           }
           return false;
       });
   });

};