$(function(){ var $win=$(window); var $header =$(".header"); var $content=$(".mainContent ul"); var $contentlist = $content.find("li"); var allWidth,_half; var $mv={ init:function(){ allWidth = parseInt($header.outerWidth(),10); _half =Math.ceil(allWidth/2); $content.css({'width':_half*2+10,'overflow':'hidden'}); $contentlist.css({width:_half}); } }; $contentlist.find("img:last-child").hide(); $contentlist.each(function(index, element) { $(this).mouseover(function(e) { $(this).find("img:first-child").hide().next("img").show(); $(this).addClass("on").siblings("li").removeClass("on");; }).mouseout(function(e) { $(this).removeClass("on").find("img:last-child").hide().prev("img").show(); });; }); setTimeout(function(){$(".header").slideUp(800);$("#main_content").css({'zIndex':100});},3000); $mv.init(); $win.resize(function(e) { $mv.init(); }); });