$(function(){//瀵艰埅js $(".allmenu li").hover( function () { $(this).find(".tag").addclass("ahover"); $(this).find(".menu").show(); }, function () { $(this).find(".tag").removeclass("ahover"); $(this).find(".menu").hide(); } ); }); var t = n = 0, count;//棣栭〉banner鍒囨崲 $(document).ready(function(){ count=$("#banner_list a").length; $("#banner_list a:not(:first-child)").hide(); $("#banner_info").html($("#banner_list a:first-child").find("img").attr('alt')); $("#banner_info").click(function(){ window.open($("#banner_list a:first-child").attr('href'), "_blank"); }); $("#banner li").click(function(){ var i = $(this).text() - 1;//鑾峰彇li鍏冪礌鍐呯殑鍊硷紝鍗?锛?锛?锛? n = i; if (i >= count) return; $("#banner_info").html($("#banner_list a").eq(i).find("img").attr('alt')); $("#banner_info").unbind().click(function(){ window.open($("#banner_list a").eq(i).attr('href'), "_blank") }) $("#banner_list a").filter(":visible").fadeout(1000).parent().children().eq(i).fadein(1000); document.getelementbyid("banner").style.background=""; $(this).toggleclass("on"); $(this).siblings().removeattr("class"); }); t = setinterval("showauto()", 5000); $("#banner").hover(function(){ clearinterval(t) }, function(){ t = setinterval("showauto()", 5000); }); }) function showauto(){ n = n >=(count - 1) ? 0 : ++n; $("#banner li").eq(n).trigger('click'); } (function($){//婊氬姩鏂伴椈 $.fn.myscroll = function(options){ var defaults = { speed:80, //婊氬姩閫熷害,鍊艰秺澶ч€熷害瓒婃參 rowheight:18 //姣忚鐨勯珮搴? }; var opts = $.extend({}, defaults, options),intid = []; function marquee(obj, step){ obj.find("ul").animate({ margintop: '-=1' },0,function(){ var s = math.abs(parseint($(this).css("margin-top"))); if(s >= step){ $(this).find("li").slice(0, 1).appendto($(this)); $(this).css("margin-top", 0); } }); } this.each(function(i){ var sh = opts["rowheight"],speed = opts["speed"],_this = $(this); intid[i] = setinterval(function(){ if(_this.find("ul").height()<=_this.height()){ clearinterval(intid[i]); }else{ marquee(_this, sh); } }, speed); _this.hover(function(){ clearinterval(intid[i]); },function(){ intid[i] = setinterval(function(){ if(_this.find("ul").height()<=_this.height()){ clearinterval(intid[i]); }else{ marquee(_this, sh); } }, speed); }); }); } })(jquery); $(function(){ $("div.ranklist").myscroll({ speed:80, rowheight:18 }); });