$(function(){ imgWidth=1680; imgheight=880; $(window).resize(function(){ resetHome(); }); resetHome(); function resetHome(){ slide=$(".section .section_bg"); var winHeight=$(window).height(); newHeight = winHeight-250; if(newHeight<660) newHeight = 660; slide.height(newHeight); //alert(winHeight); obj = $('.project_item.item_1'); if(obj.length>0) { _top = obj.offset().top; height = obj.outerHeight(); $('.project_mask').css({"left":"0","top":_top+"px","height":height+"px"}) } } $('.header-weixin').hover(function () { $(this).children('.weixin-qrcode').stop().fadeIn(); }, function () { $(this).children('.weixin-qrcode').stop().fadeOut(); }); $('.footer-link').hover(function () { $(this).children('.sub').stop().fadeIn(); }, function () { $(this).children('.sub').stop().fadeOut(); }); $('#CarouselNewThumb').carousel('pause'); $('#CarouselNewThumb').on('slid.bs.carousel', function () { $('#secNewThumb .sec_caption div').html($(this).find('.item.active .carousel-caption').html()); }); $('#CarouselNewThumb').on('slide.bs.carousel', function () { //$('#secNewThumb .sec_title').html($(this).find('.item.active .carousel-caption').html()); }) //$('#CarouselNewThumb').carousel('pause'); $('.project_album .carousel').carousel(); $('#secNewThumb .sec_caption div').html($('#CarouselNewThumb').find('.item.active .carousel-caption').html()); $('#myCarousel').carousel(); $('#myCarousel').on('slid.bs.carousel', function () { $('#secProjects .sec_title').html($(this).find('.item.active .carousel-caption').html()); }); $('#home_banner').carousel(); $('#home_banner').find('.item.active .child').fadeIn(1000); $('#home_banner').on('slid.bs.carousel', function () { $(this).find('.item.active .child ').fadeIn(1000); }); $('#home_banner').on('slide.bs.carousel', function () { $(this).find('.item.active .child').fadeOut(1000); }) $('.oper_item').hover(function(){ $('.oper_item').removeClass('active'); $(this).addClass('active'); },function(){ }); $('.sec_section .carousel-inner .item') .mouseover(function(){$(this).stop().animate({opacity:'0.7'}, 300)}) .mouseout(function(){$(this).stop().animate({opacity:'1'}, 300)}); /* .mouseout(function(){ $('.project_mask').stop().animate({opacity:'0'}, 300); }); */ $('.img-link .hover') .mouseover(function(){$(this).stop().animate({opacity:'1'}, 300)}) .mouseout(function(){$(this).stop().animate({opacity:'0'}, 300)}); /* $.get("/Api/weather", function(result){ result = result.results[0]; var date = result.daily[0].date.split("-"); wiather = date[0]+'年'+date[1]+'月'+date[2]+'日' +' ' + result.location.name + ' '+result.daily[0].high+'°C~'+result.daily[0].low+'°C'; $(".header-weather").html(wiather); }); */ $('.scrollto').click(function(event){ event.stopPropagation(); $('.scrollto').removeClass('active'); obj = $(this); obj.addClass('active'); $('html,body').animate({scrollTop:$($(obj).attr('href')).offset().top}, 800); }); }); function Tb(d, t, p, c) { for(var i=1; i<=t; i++) { if(d == i) { $('#'+p+'_t_'+i).attr('class',c+'_2'); $('#'+p+'_c_'+i).addClass('active'); } else { $('#'+p+'_t_'+i).attr('class',c+'_1'); //$('.tab-pane:eq('+(i-1)+')').removeClass('active'); $('#'+p+'_c_'+i).removeClass('active'); } } } function hsearch(i) { if($('#keyword').val().length < 1) { window.setTimeout(function(){alert('请填写搜索关键词');}, 500); return false; } return true; } //=====================全局函数======================== //Tab控制函数 function tabs(tabId, tabNum){ //设置点击后的切换样式 $(tabId + " .tab li").removeClass("curr"); $(tabId + " .tab li").eq(tabNum).addClass("curr"); //根据参数决定显示内容 $(tabId + " .tabcon").hide(); $(tabId + " .tabcon").eq(tabNum).show(); } //=====================全局函数======================== $(function(){ //$(".jqzoom").jqueryzoom({xzoom:350,yzoom:350}); $('#f_verify img').click(function(){$(this).attr('src','/index/verify.html?'+Math.random())}); }); //==================图片详细页函数===================== //鼠标经过预览图片函数 function preview(img){ $("#preview img").attr("src",$(img).attr("src")); $("#preview img").attr("jqimg",$(img).attr("bimg")); } //图片预览小图移动效果,页面加载时触发 $(function(){ var tempLength = 0; //临时变量,当前移动的长度 var viewNum = 5; //设置每次显示图片的个数量 var moveNum = 2; //每次移动的数量 var moveTime = 300; //移动速度,毫秒 var scrollDiv = $(".spec-scroll .items ul"); //进行移动动画的容器 var scrollItems = $(".spec-scroll .items ul li"); //移动容器里的集合 var moveLength = scrollItems.eq(0).width() * moveNum; //计算每次移动的长度 var countLength = (scrollItems.length - viewNum) * scrollItems.eq(0).width(); //计算总长度,总个数*单个长度 //下一张 $(".spec-scroll .next").bind("click",function(){ if(tempLength < countLength){ if((countLength - tempLength) > moveLength){ scrollDiv.animate({left:"-=" + moveLength + "px"}, moveTime); tempLength += moveLength; }else{ scrollDiv.animate({left:"-=" + (countLength - tempLength) + "px"}, moveTime); tempLength += (countLength - tempLength); } } }); //上一张 $(".spec-scroll .prev").bind("click",function(){ if(tempLength > 0){ if(tempLength > moveLength){ scrollDiv.animate({left: "+=" + moveLength + "px"}, moveTime); tempLength -= moveLength; }else{ scrollDiv.animate({left: "+=" + tempLength + "px"}, moveTime); tempLength = 0; } } }); }); //==================图片详细页函数===================== //==================图片详细页函数===================== function AddFavorite(sURL, sTitle) { try { window.external.addFavorite(sURL, sTitle); } catch (e) { try { window.sidebar.addPanel(sTitle, sURL, ""); } catch (e) { alert("加入收藏失败,请使用Ctrl+D进行添加"); } } } //设为首页 设为首页 function SetHome(obj,vrl){ try{ obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl); } catch(e){ if(window.netscape) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch (e) { alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。"); } var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); prefs.setCharPref('browser.startup.homepage',vrl); } } } // 在线客服 function changeOnline(num) { if (isNaN(num) && num == "") return; for (var i = 1; i <=6 ; i++) { if (i == num) { document.getElementById("onlineSort" + i).className = "online_bar expand"; document.getElementById("onlineType" + i).style.display = "block"; } else { document.getElementById("onlineSort" + i).className = "online_bar collapse"; document.getElementById("onlineType" + i).style.display = "none"; } } } $(document).ready(function() { $(window).scroll(function() { $("#div1").css("right", $(window).scrollTop()+700+"px"); }); }); $(document).ready(function(){ $("#floatShow").bind("click",function(){ $('#onlineService').animate({width: 'show', opacity: 'show'}, 'normal',function(){ $('#onlineService').show(); });$('#floatShow').attr('style','display:none');$('#floatHide').attr('style','display:block'); return false; }); $("#floatHide").bind("click",function(){ $('#onlineService').animate({width: 'hide', opacity: 'hide'}, 'normal',function(){ $('#onlineService').hide(); });$('#floatShow').attr('style','display:block');$('#floatHide').attr('style','display:none'); }); $(document).bind("click",function(event){ if ($(event.target).isChildOf("#online_qq_layer") == false) { $('#onlineService').animate({width: 'hide', opacity: 'hide'}, 'normal',function(){ $('#onlineService').hide(); });$('#floatShow').attr('style','display:block');$('#floatHide').attr('style','display:none'); } }); jQuery.fn.isChildAndSelfOf = function(b){ return (this.closest(b).length > 0); }; jQuery.fn.isChildOf = function(b){ return (this.parents(b).length > 0); }; });