Line 1: | Line 1: | ||
− | var navWidth; | + | var navWidth; |
var navFontSize; | var navFontSize; | ||
var navTop; | var navTop; | ||
Line 41: | Line 41: | ||
$('html').animate({scrollTop:$(x).offset().top-$("#w_nav").height()},500); | $('html').animate({scrollTop:$(x).offset().top-$("#w_nav").height()},500); | ||
}); | }); | ||
+ | $("#w_Panel").height(document.documentElement.clientHeight); | ||
+ | <!--悟空眼睛--> | ||
+ | $(document).mousemove(function(e){ | ||
+ | var x=$("#eye").width()/2; | ||
+ | var y=$("#eye").height()/2; | ||
+ | $("#eye").css({"left":parseFloat(String((e.pageX-x)/100)),"top":parseFloat(String((e.pageY-$(window).scrollTop()-y)/100))}); | ||
+ | }); | ||
+ | |||
+ | }); | ||
+ | <!--导航栏首页故事自适应--> | ||
+ | $(window).resize(function(){ | ||
+ | $("#w_Panel").height(document.documentElement.clientHeight); | ||
+ | if($(window).width()>=480){ | ||
+ | $("#w_nav>div").hide(); | ||
+ | $("#w_nav>ul").show(); | ||
+ | $("#w_nav>ul>li>a").css({"width":$(window).width()/7-10,"font-size":parseFloat(navFontSize)*parseFloat(String($(window).width()))/parseFloat(String(navWidth)),"top":parseFloat(navTop)*parseFloat(String($(window).width()))/parseFloat(String(navWidth))}); | ||
+ | $("#w_nav>ul").css({"top":parseFloat(navTop)*parseFloat(String($(window).width()))/parseFloat(String(navWidth))}); | ||
+ | navWidth=$(window).width(); | ||
+ | navFontSize=$("#w_nav>ul>li>a").css("font-size"); | ||
+ | navTop=$("#w_nav>ul").css("top"); | ||
+ | } | ||
+ | else{ | ||
+ | $("#w_nav>ul").hide(); | ||
+ | $("#w_nav>div").show(); | ||
+ | $("#w_nav>div>ul").hide(); | ||
+ | } | ||
+ | }); |
Revision as of 08:50, 7 October 2017
var navWidth; var navFontSize; var navTop; $(document).ready(function(){ $("#top_title").hide(); $("#sideMenu").hide(); if($(window).width()>=480){ $("#w_nav>div").hide(); } if($(window).width()<480){ $("#w_nav>ul").hide(); $("#w_nav>div>ul").hide(); } $("#w_nav>ul>li>a").css({"width":$(window).width()/7-10,"font-size":$(window).width()/1280*25}); $("#w_nav>ul").css({"top":$(window).width()/1280*(-41)}); navWidth=$(window).width(); navFontSize=$("#w_nav>ul>li>a").css("font-size"); navTop=$("#w_nav>ul").css("top");
$("#w_nav>div>p").click(function(){ $("#w_nav>div>ul").slideToggle(); }); /* $("#w_menu>li>ul").hide().click(function(event){ event.stopPropagation(); });
$("#w_menu>li").click(function(){ var menuFlag=true; if($(this).find('ul').is(":visible")) menuFlag=false; $("#w_menu>li>ul:visible").slideUp(); if(menuFlag) $(this).find('ul').slideToggle(); });*/ $("#w_menu>li>ul").hide(); $("#w_menu>li>ul:eq(0)").show(); $("#w_menu>li>ul>li>p").click(function(){ var x=$(this).data("id"); $('html').animate({scrollTop:$(x).offset().top-$("#w_nav").height()},500); }); $("#w_Panel").height(document.documentElement.clientHeight); $(document).mousemove(function(e){
var x=$("#eye").width()/2; var y=$("#eye").height()/2; $("#eye").css({"left":parseFloat(String((e.pageX-x)/100)),"top":parseFloat(String((e.pageY-$(window).scrollTop()-y)/100))}); });
}); $(window).resize(function(){ $("#w_Panel").height(document.documentElement.clientHeight); if($(window).width()>=480){ $("#w_nav>div").hide(); $("#w_nav>ul").show(); $("#w_nav>ul>li>a").css({"width":$(window).width()/7-10,"font-size":parseFloat(navFontSize)*parseFloat(String($(window).width()))/parseFloat(String(navWidth)),"top":parseFloat(navTop)*parseFloat(String($(window).width()))/parseFloat(String(navWidth))}); $("#w_nav>ul").css({"top":parseFloat(navTop)*parseFloat(String($(window).width()))/parseFloat(String(navWidth))}); navWidth=$(window).width(); navFontSize=$("#w_nav>ul>li>a").css("font-size"); navTop=$("#w_nav>ul").css("top"); } else{ $("#w_nav>ul").hide(); $("#w_nav>div").show(); $("#w_nav>div>ul").hide(); } });