'DOMContentLoaded'에 해당되는 글 1건
- 2008/10/12 emulating DOMContentLoaded
(function () {윈도우의 경우 htc가 연결된 경우 (ex : IE6 png Hack) 모든 htc 동작이 끝난 후에 이벤트가 발생하게 된다.
var loadCallBack = function () {
if (document.domParsed) return;
document.domParsed = true;
Event.readyCache.each(function (fn) { fn.apply(document); });
Event.readyCache = null;
loadCallBack = null;
};
if (Browser.isWebKit || (Browser.isOpera && window.opera.version() < 9)) {
(function () {
if (/loaded|complete/.test(document.readyState)) return $stop;
}).interval(1, loadCallBack);
}
else if (Browser.isIE) {
var temp = document.createElement("div");
(function () {
try {
temp.doScroll('left');
temp = null;
return $stop;
}
catch (ex) {}
}).interval(1, loadCallBack);
}
else {
document.addEventListener("DOMContentLoaded", loadCallBack, false);
}
})();
이 경우
스타일에
body {behavior: url(/js/loaded.htc);}
를 선 언해 주고
loaded.htc 파일은 다음과 같이 작성해주면 된다.
<public:component lightweight="true">htc를 사용할 경우 사용하면 된다.
<public:attach event="ondocumentready" for="window" onEvent="loadCallBack()" />
</public:component>






Recent Comment