// javascript document $(function(){ $(window).scroll(function(){ if($(window).scrolltop()>0){ $('.tqchina_banner_load').hide(); }else{ $('.tqchina_banner_load').show(); } }); //第一个图片的显示: if($('#tqchina_banner').find('li').eq(0).find('#player').css('display')=='none'){ var o_olen=$('#tqchina_banner').find('li').eq(0).find('.img_hidden img').length var o_rans1 = parseint(math.random() * o_olen); var o_osrc=$('#tqchina_banner').find('li').eq(0).find('.img_hidden img').eq(o_rans1).attr('src'); $('#tqchina_banner').find('li').eq(0).find('.intro .all_img>img').attr('src',o_osrc); } //固定高度按比例求宽度 var dom_height=$(window).height()-$('.header').height(); $(window).resize(function () { dom_height=$(window).height()-$('.header').height(); if($(window).width()>1200){ $(".ban_box").each(function () { mainbgresize1($(this).find(".intro"), $(window).width(), dom_height, 1920, 800); }); $('#player video').attr({ width:$('.intro').width(), height:$('.intro').height() }); }else{ $('#player video').attr({ width:$(window).width(), height:$(window).width()*0.421 }); } }).resize(); gotol(15); $('#tqchina_banner li').each(function(index,elem){ if($(this).find('video').size()>0 && !$('html').hasclass('lt9')){ $(this).find('video').get(0).play(); } if($(this).data('position')!=undefined){ if($(this).data('position')=='p_left'){ $(this).addclass('ba_left'); } if($(this).data('position')=='p_right'){ $(this).addclass('ba_right'); } } }); }) function gotol(sp) { $(".tqchina_banner_load i").css({ width: 0 }); $(".tqchina_banner_load i").stop().animate({ width: "100%" }, sp * 1000,'linear'); } function mainbgresize1($img, width, height, w_b, h_b) { var sw = width, sh = width / w_b * h_b if (sh < height) { sh = height; sw = height / h_b * w_b } $img.css({height:sh,width:sw, margintop: -(sh - height) / 2, marginleft: -(sw - width) / 2, 'visibility': 'visible' }); }