$(function(){ allhome(); }); function allhome(){ $('a').focus(function(){ $(this).blur(); }); changeimages(5); //宸﹀彸 //homeform(); //鐐瑰嚮灏忓浘 $('#small_imgs a.item:first').find('div.img').addclass('active'); var allimg = $('#small_imgs .img'); var big_img = $('#big_img'); var big_a = $('#big_a'); var small_next = $('#small_next'); var stop2 = false; allimg.mouseover(function(){ if($(this).hasclass('active'))return; allimg.removeclass('active'); $(this).addclass('active'); var img = $(this).attr('b'); var link = $(this).attr('l'); var theid = $(this).attr('theid'); if(big_img.queue('fx').length!=0){ big_img.stop(true); } big_img.animate({'opacity':'0.2'},400,function(){ big_img.css('background-image','url('+img+')'); if(link==''){ big_a.attr('href','javascript:;').attr('onclick',"pgvsendclick({hottag:'hrtencent.home.banner.banner"+theid+"'});").addclass('cdefault'); }else{ big_a.attr('href',link).attr('onclick',"pgvsendclick({hottag:'hrtencent.home.banner.banner"+theid+"'});").removeclass('cdefault'); } big_img.animate({'opacity':'1'},700); }); }); allimg.eq(0).removeclass('active'); allimg.eq(0).mouseover(); $('#home_banner').mouseover(function(){ stop2=true; }).mouseout(function(){ stop2=false; }); var marquee2 = autoswitchhomebanner(allimg); mymar2 = setinterval(marquee2,6000); function autoswitchhomebanner(allimg){ return (function(){ if(stop2)return; var index = 0; $('#small_imgs .img').each(function(i){ if($(this).hasclass('active')){ index = i;return false; } }); if(index>=4){ small_next.click(); } var next = $('#small_imgs .img.active:first').parent().next().find('.img'); if(next.length==0){ next = allimg.eq(0); } next.mouseover(); stop2 = false; }); } } //宸﹀彸鐐瑰嚮鍥剧墖 function changeimages(allowl) { var itemall = $('#small_imgs .item'); iteml = itemall.length; if (iteml <= allowl) {// 灏戜簬鏈€澶ф樉绀烘暟 $('#small_pre,#small_next').css('background', 'none'); return; } iteml = ((iteml - allowl) > allowl) ? allowl : (iteml - allowl); imagesswitch33('#small_pre', '#small_next', itemall, 900, iteml); } /* * 鍥剧墖鍒囨崲33涓嶈嚜鍔?iteml = jquery(this).find('.smallitem').length; iteml = * ((iteml-allowl)>allowl)?allow:(iteml-allowl); * imagesswitch33(pre,next,jquery(this).find('.smallitem'),900,iteml); */ function imagesswitch33(left, right, items, movetime, num) { movetime = (parseint(movetime)) ? movetime : 400; items.parent().css({ position : 'relative', overflow : 'hidden' }); items.parent().wrapinner('
'); items.parent().css('position', 'absolute'); items.parent().css('left', '0'); var offw = items.eq(0).outerwidth(true); var allw = items.outerwidth(true) * (items.length); var movew = offw * num; items.parent().width(allw + 'px'); var len = items.length; var isclick = false; jquery(left).click(function() { if (items.parent().queue('fx').length != 0) return; isclick = true; items.parent().prepend(items.parent().children().slice(len - num, len)); items.parent().css('left', '-' + movew + 'px'); items.parent().animate({ left : '+=' + movew + 'px' }, movetime, function() { items.parent().css('left', 0); }); }); jquery(right).click(function() { if (items.parent().queue('fx').length != 0) return; isclick = true; items.parent().animate({ left : '-=' + movew + 'px' }, movetime, function() { items.parent().append(items.parent().children().slice(0, num)); items.parent().css('left', 0); }); }); }