$(document).ready(function(){ $(".menu-list li:last").css("background","none"); $(".menu-list li").hover(function() { $(this).children("a").addClass("current"); $(this).children("div").show(); }, function() { $(this).children("a").removeClass("current"); $(this).children("div").slideUp(); }); $('.banners').scrollable({size:1,items:'.banners ul',loop:true,prev:"a.banner-left",next:"a.banner-right"}).autoscroll({autoplay: true,autopause:false,interval:8000,steps:1}); }); function CheckSearch(){ CheckForm = document.productsearch if (CheckForm.keyword.value==""){ alert("请输入关键字"); CheckForm.keyword.focus(); return false; } if (CheckForm.keyword.value=="请输入关键字"){ alert("请输入关键字"); CheckForm.keyword.focus(); return false; } } function scrolldiv(id){ var menuYloc = $(id).offset().top; $(window).scroll(function (){ var offsetTop = menuYloc + $(window).scrollTop() +"px"; $(id).animate({top : offsetTop },{ duration:600 , queue:false }); }); } function AutoResizeImage(maxWidth,maxHeight,objImg){ var img = new Image(); img.src = objImg.src; var hRatio; var wRatio; var Ratio = 1; var w = img.width; var h = img.height; wRatio = maxWidth / w; hRatio = maxHeight / h; if (maxWidth ==0 && maxHeight==0){ Ratio = 1; }else if (maxWidth==0){// if (hRatio<1) Ratio = hRatio; }else if (maxHeight==0){ if (wRatio<1) Ratio = wRatio; }else if (wRatio<1 || hRatio<1){ Ratio = (wRatio<=hRatio?wRatio:hRatio); } if (Ratio<1){ w = w * Ratio; h = h * Ratio; } objImg.height = h; objImg.width = w; }