$(function () { $(".nav-menu > li").hover(function() { var $container = $(this), $list = $container.find(".sub-nav"); $list.slideDown(500); }, function() { var $el = $(this); $el.find(".sub-nav") .hide() .end(); }); var html = $(".en .bread-con").html(); if(html != undefined) $(".en .bread-con").html(html.replace("首页","HomePage")); $(window).resize(function() { var width = $(window).width(); var height = 458; if(width>=1200) height = 458; else if(width>=992) height = 378; else if(width>=768) height = 293; else if(width>=479) height = 182; else if(width<479) height = 160; $('#banner').height(height); }); if($(window).width()> 767){ window.onscroll = function(){ var zhead = $(".header").height() + 5; //获取头部高度 var sTop = $(document).scrollTop(); //滚动事件 if( parseInt(sTop) > zhead){ //触发条件,显示返回顶部按钮,可使用数 $(".gotop").show(); }else { $(".gotop").fadeOut(800); } $(".gotop").on("click",function(){ //滚动速度 $("body,html").stop().animate({scrollTop:0}, 800); }); if(window.screen.width <= 768){ //判断分辨 $(".gotop").remove(); } } } $(".navi-slide-arrow").on("click",function(){ $(".headr-nav-con .nav-menu").slideToggle(250); }); $("body,html").click(function(){ $(".searchbox").animate({"width":"35px"}); $(".headr-search-form").css("width","35px"); $(".searchbtn").stop(true,true).fadeIn(); }); $(".searchbtn").click(function(){ $(this).stop(true,true).fadeOut(); $(".headr-search-form").css("width","200px"); $(".searchbox").stop(true,true).animate({"width":"200px"}); return false; }); $(".search-input").click(function(){ return false; }); $(".search-submit").click(function(event) { //$(this).removeAttr("name"); //event.preventDefault(); var val = $.trim($(".search-input").val()); if(val!==""){ return true; }else{ alert("请输入关键词"); return false; } }); $(".page-con-list .news-newslist img").one('error',function () { $(this).attr('src', '/_upload/tpl/03/85/901/template901/images/pic-sxy.jpg'); }); $(".page-con-list .xysh-piclist img").one('error',function () { $(this).attr('src', '/_upload/tpl/03/85/901/template901/images/pic-xysh.jpg'); }); $('a[href^="http://222.30.60.20"]').each(function() { let href = $(this).attr('href'); href = href.replace('http://222.30.60.20', 'https://ibs.nankai.edu.cn'); $(this).attr('href', href); }) });