function imgratio() {//ͼƭ ratio�������� $(".ratio-img").each(function (index, element) { if($(this).is(":visible")) { $(this).css({height:math.floor($(this).width()*$(this).data("ratio"))}); } }); if ($(".menu_h").is(":visible")) { $(".body-box").height($(window).height()); $("a").each(function (e) { $(this).attr({ "target": "_self" }) }); } else { $(".body-box").css({ height: "auto" }); } } $(function () { imgratio()//��ʼ��ͼƭratio settimeout(function () { imgratio(); }, 300) $(".ratio-img").each(function (index, element) { $(this).attr({ "src": $(this).data("src") }); }); //���ڸı��с�ص�ratio�� var rtime = new date(); var timeout = false; var delta = 500; $(window).resize(function () { rtime = new date(); if (timeout === false) { timeout = true; if (!$("html").hasclass("ie7")) { settimeout(resizeend, delta); //resizeֻ�ص����һ�� } } }); function resizeend() { //window.resize�ص� if (new date() - rtime < delta) { settimeout(resizeend, delta); } else { timeout = false; imgratio()//ratio } } // }) //��ͼͼ�� var nullimg = 'images/error.png'; function lod(t) { t.onerror = null; t.src = nullimg } $(function () { $(".ratio-img").each(function () { if ($(this).attr("src") == "") { $(this).attr({ "src": nullimg }) } }) })