function goTop() { $(window).scroll(function(e) { $(console.log($(window).scrollTop())); //若滚动条离顶部大于100元素 if($(window).scrollTop()>100) { $("#gotop").fadeIn(1000);//以1秒的间隔渐显id=gotop的元素 } else { $("#gotop").fadeOut(1000);//以1秒的间隔渐隐id=gotop的元素 } }); }; $(function() { $('.yb_conct').mouseenter(function() { $(this).css('right', '2px'); $(this).find('.yb_ercode').css('height', '200px'); }).mouseleave(function() { $(this).css('right', '-127px'); $(this).find('.yb_ercode').css('height', '53px'); }) $(".yb_top").click(function(e) { //以1秒的间隔返回顶部 $('body,html').animate({scrollTop:0},1000); }); var advbox = $(".advbox img"); var advboxWidth = advbox.width(); if (advboxWidth != 0) { showad(); } else { var advbox = $(".advbox img").load(function() { showad(); }); } /* if($(window).scrollTop()>100) { $("#gotop").show(); } else { $("#gotop").hide();//以1秒的间隔渐隐id=gotop的元素 } //点击回到顶部的元素 $("#gotop").click(function(e) { //以1秒的间隔返回顶部 $('body,html').animate({scrollTop:0},1000); }); goTop();//实现回到顶部元素的渐显与渐隐 */ $('#search').focusin(function() { $(this).parent().addClass("hover"); }).focusout(function() { $(this).parent().removeClass("hover"); }) var imageLayer = null; $('[hover-pic]').hover(function() { var img = $(this).attr('hover-pic'); $(this).css('position', 'relative'); if (!imageLayer) { imageLayer = $('
') } console.log($(this).width()); imageLayer.css('left', ($(this).width() + 5) + 'px'); imageLayer.css('top', '0'); $(this).append(imageLayer); }, function() { if(imageLayer) { imageLayer.remove(); } }) $('.form-control-feedback').click(function() { $('#search').focus(); if(!$("#search").val()){ alert("请输入关键字!"); return false; } $(this).parents('form').submit(); }) $(document).off('click.bs.tab.data-api', '[data-hover="tab"]'); $(document).on('mouseenter.bs.tab.data-api', '[data-toggle="tab"], [data-hover="tab"]', function () { $(this).tab('show'); }); $("#banner-slider").owlCarousel({ navigation : true, // Show next and prev buttons slideSpeed : 300, paginationSpeed : 400, singleItem:true, navigationText: [ "", "" ], }); $('#solution-slider').owlCarousel({ items:6, navigation: true, pagination: false, navigationText: [ "", "" ] }); $('#product-nav-slider').owlCarousel({ items:5, navigation: true, pagination: false, navigationText: [ "", "" ] }); $('.placeholder').owlCarousel({ items:5, navigation: false, pagination: false }); $('.products .image img').cover({loadHidden: false}); $('.banner img').cover(); $('.cover').cover(); $('.coverimg').each(function(i, v) { $(v).hide(); var ph = $(v).parent().height(); var pw = $(v).parents('.frame').width(); $("") .attr("src", $(v).attr('src')) .load(function() { var w = this.width; var h = this.height; if (w > pw || h > ph) { if (w/pw >= h/ph) { h = h/w * pw; w = pw; } else { w = w/h * ph; h = ph; } } $(v).css("width", w + 'px'); $(v).css("height", h + 'px'); if (h < ph) { $(v).css("margin-top", (ph - h)/2 + 'px') } }); $(v).show(); }); $('.menu-link').bigSlide({side: "right", menuWidth: "280px"}); $('.solution-summary .solution').hover(function() { $('.solution-summary .solution').addClass("gray"); $(this).removeClass("gray"); }); // $('#product-menu').hover(function() { // $('.product-nav').addClass("active"); // }); $('.top-nav div.item a').hover(function() { if ($(this).attr("id") == "product-menu") { $('.product-nav').addClass("active"); } else { $('.product-nav').removeClass("active"); } }); $('.top-nav').on('mouseleave', function() { $('.product-nav').removeClass("active"); }) })