$(function(){ //鎵嬫満瀵艰埅 $(".header2 .nav-btn").on('click', function() { var _this = $(this); if (!$(this).hasClass('hover')) { $(this).addClass('hover'); $(this).children('.line1').stop(true,true).transition({rotate: 45}, 300); $(this).children('.line2').stop(true,true).fadeOut(300); $(this).children('.line3').stop(true,true).transition({rotate: -45}, 300,function(){ _this.addClass('active'); }); $(this).parent(".main-wrap").siblings('.sub-menu').stop().fadeIn(); $("header .list-cont").addClass('active'); $("body,html").stop(true,true).addClass('ovh-f'); $(".search-bg").stop(true,true).fadeIn(); $(".header2").addClass('active'); $(".sub-menu li").addClass("animate"); }else{ $(this).removeClass('hover'); $(this).removeClass('active'); $(this).children('.line1').stop(true,true).transition({rotate: 0}, 300); $(this).children('.line2').stop(true,true).fadeIn(300); $(this).children('.line3').stop(true,true).transition({rotate: 0}, 300); $(this).parent(".main-wrap").siblings('.sub-menu').stop().fadeOut(); $("header .list-cont").removeClass('active'); $("body,html").stop(true,true).removeClass('ovh-f'); $(".search-bg").stop(true,true).fadeOut(); $(".header2").removeClass('active'); $(".sub-menu li").removeClass("animate"); } }); // $(window).scroll(function(){ // var k1 = $(window).scrollTop()/2; // $(".n-banner").css("background-position-y",k1); // }) $('.backtop').on('click',function(){ $('html,body').animate({ scrollTop: 0 },600, 'easeInOutQuad'); }); var scrollFunc = function (e) { //var direct = 0; e = e || window.event; if (e.wheelDelta) { //鍒ゆ柇娴忚鍣↖E锛岃胺姝屾粦杞簨浠 if (e.wheelDelta > 0 && $(window).scrollTop() > 0 && $(window).width()>=1024) { //褰撴粦杞悜涓婃粴鍔ㄦ椂 //alert("婊戣疆鍚戜笂婊氬姩"); $('.backtop').addClass('active'); } if (e.wheelDelta < 0 && $(window).scrollTop() > 0 && $(window).width()>=1024) { //褰撴粦杞悜涓嬫粴鍔ㄦ椂 //alert("婊戣疆鍚戜笅婊氬姩"); $('.backtop').removeClass('active'); } } else if (e.detail) { //Firefox婊戣疆浜嬩欢 if (e.detail == -3 && $(window).scrollTop() > 0 && $(window).width()>=1024) { //褰撴粦杞悜涓婃粴鍔ㄦ椂 //alert("婊戣疆鍚戜笂婊氬姩"); $('.backtop').addClass('active'); }else if (e.detail !== -3 && $(window).scrollTop() > 0 && $(window).width()>=1024){ //褰撴粦杞悜涓嬫粴鍔ㄦ椂 //alert("婊戣疆鍚戜笅婊氬姩"); $('.backtop').removeClass('active'); } } if (e.wheelDelta) { //鍒ゆ柇娴忚鍣↖E锛岃胺姝屾粦杞簨浠 if (e.wheelDelta > 0 && $(window).scrollTop() > 80 && $(window).width()>=1024) { //褰撴粦杞悜涓婃粴鍔ㄦ椂 //alert("婊戣疆鍚戜笂婊氬姩"); $('.n-fixheight').removeClass('fixed'); } if (e.wheelDelta < 0 && $(window).scrollTop() > 80 && $(window).width()>=1024) { //褰撴粦杞悜涓嬫粴鍔ㄦ椂 //alert("婊戣疆鍚戜笅婊氬姩"); $('.n-fixheight').addClass('fixed'); } } else if (e.detail) { //Firefox婊戣疆浜嬩欢 if (e.detail == -3 && $(window).scrollTop() > 80 && $(window).width()>=1024) { //褰撴粦杞悜涓婃粴鍔ㄦ椂 //alert("婊戣疆鍚戜笂婊氬姩"); $('.n-fixheight').removeClass('fixed'); }else if (e.detail !== -3 && $(window).scrollTop() > 80 && $(window).width()>=1024){ //褰撴粦杞悜涓嬫粴鍔ㄦ椂 //alert("婊戣疆鍚戜笅婊氬姩"); $('.n-fixheight').addClass('fixed'); } } } //缁欓〉闈㈢粦瀹氭粦杞粴鍔ㄤ簨浠 if (document.addEventListener) { document.addEventListener('DOMMouseScroll', scrollFunc, false); } //婊氬姩婊戣疆瑙﹀彂scrollFunc鏂规硶 window.onmousewheel = document.onmousewheel = scrollFunc; scrollAni(); visual_button_scroll_down(); visual_button_scroll_down2() if ($(".n-banner").length==1 || $(".n-banenr-two").length==1) { $(".n-banner").addClass("active"); $(".n-banenr-two").addClass("active"); setTimeout(function(){ text({ str: $('#text').data("text"), effect: "right", speed :$('#text').data("time"), }); },500) }; }); function visual_button_scroll_down(){ $('.scroll_down').on('click',function(){ var target = $(this).attr('href'); var target_top = $(target).offset().top; $('html,body').animate({ scrollTop : target_top },600, 'easeInOutQuad'); return false; }); } function visual_button_scroll_down2(){ $('.scroll_down2').on('click',function(){ var target = $(this).attr('href'); var target_top = $(target).offset().top-60; $('html,body').animate({ scrollTop : target_top },600, 'easeInOutQuad'); return false; }); } function scrollAni() { $('.js-m').each(function() { var _this = $(this); if (_this.offset().top > $(window).scrollTop() + $(window).height() || _this.offset().top < $(window).scrollTop() - _this.outerHeight()) { // _this.removeClass('animate'); } else if ($(window).scrollTop() > _this.offset().top - $(window).height() * 0.95) { _this.addClass('animate'); } }); $(window).scroll(function() { $('.js-m').each(function() { var _this = $(this); if (_this.offset().top > $(window).scrollTop() + $(window).height() || _this.offset().top < $(window).scrollTop() - _this.outerHeight()) { // _this.removeClass('animate'); } else if ($(window).scrollTop() > _this.offset().top - $(window).height() * 0.95) { _this.addClass('animate'); // $(_this) // startScramble('.i-img-list.animate .home-dec'); // startScramble('.i-lista.animate .home-dec'); } }); }); } function startScramble(name) { $(name).each(function (i, item) { var newText = $(item).data('text') || $(item).text(); var delay = Number($(item).data('delay')) || 0; setTimeout(function () { $(item).attr('data-text', newText); setScramble(item, [newText]); }, delay); }); } function setScramble(text, phrase) { var count = 0; var scramble = new TextScramble(text); scramble.setText(phrase[count]); var doScramble = function doScramble() { scramble.setText(phrase[count]).then(function () { setTimeout(doScramble, 800); }); count = (count + 1) % phrase.length; } //doScramble(); } function btnhover(obj){ var ink, d, x, y; var ulbox = obj; ulbox.find("a").bind("click touchstart", function(e) { $(".ink").remove(); if ($(this).children(".ink").length === 0) { $(this).prepend("") } ink = $(this).find(".ink"); ink.removeClass("animate-ink"); if (!ink.height() && !ink.width()) { d = Math.max($(this).outerWidth(), $(this).outerHeight()); ink.css({ height: d, width: d }) } x = e.pageX - $(this).offset().left - ink.width() / 2; y = e.pageY - $(this).offset().top - ink.height() / 2; ink.css({ top: y + 'px', left: x + 'px' }).addClass("animate-ink") }) } /* var _id = getUrlParam("id"); if (_id == 6) { alert(0); } */ function getUrlParam(name){ var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r!=null) return unescape(r[2]); return null; }