嵌入的Google日历已加载时的回调 [英] Callback when embedded Google Calendar has loaded
本文介绍了嵌入的Google日历已加载时的回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我以标准方式加载嵌入的Google日历:
I am loading an embedded Google calendar the standard way:
<iframe id="calendar" src="https://www.google.com/calendar/embed...></iframe>
我想在加载事件后使用jQuery应用一些样式更改,例如:
I want to apply some style changes after the load event using jQuery, e.g.:
$('iframe#calendar').contents().find('.blahblah').css("display", "none");
我可能需要使用间隔循环:
I presumably need to use an interval loop:
var interval_calendar = setInterval(function(){
if ($('#calendar').SOMETHING) {
clearInterval(interval_calendar);
$('iframe#calendar').contents().find('.blahblah').css("display", "none");
}
} ,200);
我可以检查日历是否已加载?基本上,我需要 SOMETHING
。
How can I check that the calendar is loaded? Basically, I need the SOMETHING
.
推荐答案
尝试
var iframe = $("<iframe>", {
"id" : "calendar",
"src" : "https://www.google.com/calendar/embed...",
"target" : "_top"
})
// `iframe` `load` `event`
.on("load", function (e) {
$(e.target)
.contents()
.find(".blablah")
.css("display", "none");
return false
});
// $(element).append($(iframe))
jsfiddle http://jsfiddle.net/guest271314/a3UL5/
jsfiddle http://jsfiddle.net/guest271314/a3UL5/
这篇关于嵌入的Google日历已加载时的回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文