浏览文章
文章信息
js等待元素出现进行操作
663
/*元素怒检测*/
function elementLoaded(el, cb) {
if ($(el).length) {
// Element is now loaded.
cb($(el));
} else {
// Repeat every 500ms.
setTimeout(function() {
elementLoaded(el, cb)
}, 50);
}
}