$(function(){ var elmArr = [], $win = $(window); $(".visible").each(function(i,elm){ $(elm).data("ot",$(elm).offset().top); elmArr.push(elm); }); dealClass(1); $win.on("scroll",dealClass); function dealClass(isRemove){ var top = $win.height() + $win.scrollTop(); if(isRemove!=1) { //滚动页面时的判断,并添加class="visible" for (var i = 0,$elem; i < elmArr.length; i++) { $elem = $(elmArr[i]); if ($elem.data("ot") <= top) { $elem.addClass("visible"); elmArr.splice(i, 1); --i; } } }else{ //初始化页面时的判断,并删除class="visible" for (var i = 0,$elem; i < elmArr.length; i++) { $elem = $(elmArr[i]); if ($elem.data("ot") >= top) { $elem.removeClass("visible"); } } } } }) $(function(){ if ($('.counter').length) { var counter = $('.counter'); counter.waypoint(function (direction) { if (direction == 'down') { counter.countTo(); } }, { offset: '64%'}); } }); jQuery(document).ready(function($){ $(".qqkefu .qq_top").click(function () { $("html,body").animate({ "scrollTop": 0 }, 300); }); $(window).scroll(function () { var scrollTop = document.body.scrollTop; var y = $('.qq_top').offset().top; if (scrollTop > 900 || y > 900) { $(".qq_top").css({ "opacity": "0.9", "filter": "alpha(opacity=90)" }); } else { $(".qq_top").css({ "opacity": "0", "filter": "alpha(opacity=0)" }); } }); $("#zx").hover(function () { if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE7.0") { $("#zx").stop(true, false).animate({ "width": "222px", "left": "-75px" }, 300); } else { $("#zx").stop(true, false).animate({ "width": "222px"}, 300); } }, function () { if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE7.0") { $("#zx").stop(true, false).animate({ "width": "53", "left": "0" }, 300); } else { $("#zx").stop(true, false).animate({ "width": "53"}, 300); } }); $("#BizQQWPA").hover(function () { if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE7.0") { $("#BizQQWPA").stop(true, false).animate({ "width": "250px", "left": "-75px" }, 300); } else { $("#BizQQWPA").stop(true, false).animate({ "width": "250px"}, 300); } }, function () { if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE7.0") { $("#BizQQWPA").stop(true, false).animate({ "width": "53", "left": "0" }, 300); } else { $("#BizQQWPA").stop(true, false).animate({ "width": "53"}, 300); } }); $("#youx").hover(function () { if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE7.0") { $("#youx").stop(true, false).animate({ "width": "300px", "left": "-75px" }, 300); } else { $("#youx").stop(true, false).animate({ "width": "300px"}, 300); } }, function () { if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE7.0") { $("#youx").stop(true, false).animate({ "width": "53", "left": "0" }, 300); } else { $("#youx").stop(true, false).animate({ "width": "53"}, 300); } }); $(".qq_czb").hover(function () { $(".erweima").show(50); }, function () { $(".erweima").hide(50); }); $(".qq_czb1").hover(function () { $(".erweima1").show(50); }, function () { $(".erweima1").hide(50); }); $(".qq_czb2").hover(function () { $(".erweima2").show(50); }, function () { $(".erweima2").hide(50); }); $('.main-navigation .menu a').each(function(){ if($($(this))[0].href==String(window.location)) $(this).addClass('first'); }); });