function init() { if (!IsPC()) { window_w = $(window).width(); console.log(window.innerWidth); if (window_w >= 768) { $('#main').addClass('pc').removeClass('mb'); resize(0, 1200, window_w); } else { $('#main').addClass('mb').removeClass('pc'); resize(0, 640, window_w); } console.log('false: ' + IsPC()); console.log('false: ' + window_w); JPlaceHolder.init(); } else { window_w = window.screen.width; console.log('true: ' + window_w); $('#main').addClass('mb').removeClass('pc'); resize(0, 640, window_w); } } function IsPC() { isPC = true; if ((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad|Touch|PlayBook|SymbianOS|Windows Phone|Nokia)/))) { isPC = true; } else { isPC = false; } return isPC; } // 鑷€傚簲灞忓箷澶у皬 function resize(min_w, max_w, window_w) { // var font_size = Math.round((window_w/max_w*6.25)*10000)/100; font_size = Math.round((window_w / max_w * 6.25) * 10000) / 100; if (window_w >= min_w && window_w <= max_w) { $('html').css({ 'font-size': font_size + "%" }); } else if (window_w > max_w) { $('html').css({ 'font-size': "625%" }); } } var JPlaceHolder = { _check: function () { return 'placeholder' in document.createElement('input'); }, init: function () { if (!this._check()) { this.fix(); } }, fix: function () { jQuery(':input[placeholder]').each(function (index, element) { var self = $(this), txt = self.attr('placeholder'); self.wrap($('
').css({ position: 'relative', zoom: '1', border: 'none', background: 'none', padding: 'none', margin: 'none' })); var pos = self.position(), h = self.outerHeight(true), paddingleft = self.css('padding-left'); var holder = $('').text(txt).css({ position: 'absolute', left: pos.left, top: pos.top, height: h, lienHeight: h, paddingLeft: paddingleft, color: '#aaa' }).appendTo(self.parent()); self.focusin(function (e) { holder.hide(); }).focusout(function (e) { if (!self.val()) { holder.show(); } }); holder.click(function (e) { holder.hide(); self.focus(); }); }); } }; function cds() { var deg = 0; var int; var hover = 0; $('.cds-list li').on('mouseover', function () { console.log(1); if (hover === 0) { var that = $(this); int = setInterval(function () { deg += 10; that.find('b')[0].style.transform = 'rotate(' + deg + 'deg)'; }, 50); hover = 1; } }).on('mouseleave', function () { if (hover == 1) { clearInterval(int); deg = 0; $(this).find('b')[0].style.transform = 'rotate(0deg)'; hover = 0; } }); } // 导航栏 function navHover () { var top = 0; $(window).scroll(function () { top = $(this).scrollTop() if ( top !== 0 ) { $('.header').css({'background': '#fff'}) } else { $('.header').css({'background': 'none'}) } }); $('.nav-list > li').on('mouseover', function () { if(top == 0) { $('.header').css({'background': '#fff'}) } $('.header').css({'border-bottom': '1px solid #e9eaea'}); var findRes = $(this).find('.sec-nav').length; var num = $('.sec-nav').length; if (findRes > 0) { for (var i = 0; i < num; i++) { $('.sec-nav').eq(i).slideUp(); } if ($('.sec-nav').is(':visible')) { $(this).find('.sec-nav').stop().show(); } else { $(this).find('.sec-nav').slideDown(); } }else { for (var i = 0; i < num; i++) { $('.sec-nav').eq(i).slideUp(); } } }); $('.header').on('mouseleave', function () { $('.sec-nav').slideUp(function () { setTimeout(function () { if(top == 0) { $('.header').css({'background': 'none'}) } $('.header').css({'border-bottom': '0'}); }, 300) }); }) } function navHover1 () { var top = 0; $(window).scroll(function () { top = $(this).scrollTop(); }); $('.nav-list > li').on('mouseover', function () { if(top == 0) { $('.header').css({'background': '#fff'}) } $('.header').css({'border-bottom': '1px solid #e9eaea'}); var findRes = $(this).find('.sec-nav').length; var num = $('.sec-nav').length; if (findRes > 0) { for (var i = 0; i < num; i++) { $('.sec-nav').eq(i).slideUp(); } if ($('.sec-nav').is(':visible')) { $(this).find('.sec-nav').stop().show(); } else { $(this).find('.sec-nav').slideDown(); } }else { for (var i = 0; i < num; i++) { $('.sec-nav').eq(i).slideUp(); } } }); $('.header').on('mouseleave', function () { $('.sec-nav').slideUp(function () { setTimeout(function () { if(top == 0) { $('.header').css({'background': 'none'}) } $('.header').css({'border-bottom': '0'}); }, 300) }); }) } // 首页 工程案例 function caseHover () { $('.case-list').on('mouseover', 'li', function () { $(this).find('.case-hover').removeClass('moveOut').addClass('moveIn') } ).on('mouseleave', 'li', function () { $(this).find('.case-hover').removeClass('moveIn').addClass('moveOut') }) } // 首页新品上市 function newPro() { // 显示右边的详情图片 var index = 0; $('.npr-r-box').eq(0).show(); // 判断有几个三个产品一列 var line = $('.npr-l-list .npr-l-box').length; // 每个产品的点击 $(document).on('click', '.nprl-pic-box', function() { var picI = $(this).index(); index = ($(this).parent('.npr-l-list').index() * 3) + picI; active($('.nprl-pic-box'), 'new-pro-on', picI); var num = $('.npr-r-box').length; for(var i=0; i 1) { click = (++click > (line - 1))?(line - 1):click; $('.npr-l-list').animate({'left': -(click * 240) + 'px'}, 500, function() { animated = 0; }); // 图片切换的时候,on对象跟着变,右边的图片详情页跟着变 proOn(click); } } }); } // 左右切换的时候,右边图片自动定位到相对应的产品 function proOn(aIndex) { var num = $('.nprl-pic-box').length; for(var i=0; i0 || navigator.userAgent.indexOf("MSIE 9.0")>0) { console.log('ie'); formEle.find('label').css({'display':'block'}); formEle.find('label').on('click', function() { $(this).parent('form').find('input').focus(); }); formEle.find('input').on('keyup', function() { if($(this).val().length == 0) { $(this).parent('form').find('label').css({'display':'block'}); }else { $(this).parent('form').find('label').css({'display':'none'}); } }); } } // 人才招聘 动画 function job() { $('.job-detail').stop().slideDown('slow'); } function jobClose() { $('.job-detail').stop().slideUp('slow'); } // 问卷调查 function btn() { $('.check-box a').attr('data-click',0); $('.qt').on('click', 'a', function() { var index = $(this).parent('p').parent('dd').parent('dl').index(); var type = $(this).parent('p').parent('dd').attr('class'); switch(type) { case 'radio': num = $(this).parent('p').parent('dd').parent('dl').find('a').length; for(var i=0; i= 1) { check = true; }else { check = false; } break; case 'num': var val = $('.num input').val(); if(val != '' && isNaN(val) == false) { check = true; }else { check = false; } break; } qtNum.push({'num':i,'res':check}); console.log(qtNum[i]); } forNum = 0; for(var i=0; i 200) { $('.backTop-box').show(); }else { $('.backTop-box').hide(); } }); } // 新闻列表切换 function newsTab(index) { var num = $('.news-tab li').length; for(var i=0; i 7) { for (var j = 0; j < m; j++) { $(".header_daohan ul li").eq(7 + j).hide(); } $(".header_menu").click(function () { if (temp == 1) { for (var j = 0; j < m; j++) { $(".header_daohan ul li").eq(j).hide(); } for (var j = 0; j < m; j++) { $(".header_daohan ul li").eq(7 + j).show(); } temp = 2; } else { for (var j = 0; j < m; j++) { $(".header_daohan ul li").eq(j).show(); } for (var j = 0; j < m; j++) { $(".header_daohan ul li").eq(7 + j).hide(); } temp = 1; } }); } }); function topSearch() { var key = $("#key").val(); if (!key || key == "") { alert('请输入搜索关键字'); return false; } return true; } $(function () { $('.header_search').click(function () { $('.search_form').toggleClass('open'); return false; }); })