Javascript 在iFrame之间切换(避免在重新加载时显示闪烁)
我在下面有两个iFrame:Javascript 在iFrame之间切换(避免在重新加载时显示闪烁),javascript,jquery,reactjs,iframe,Javascript,Jquery,Reactjs,Iframe,我在下面有两个iFrame: <div id="GCalFrame"> {this.props.onMainCalendar && <iframe key={this.props.refresh} src="https://calendar.google.com/ca
<div id="GCalFrame">
{this.props.onMainCalendar && <iframe key={this.props.refresh}
src="https://calendar.google.com/calendar/embed?height=600&wkst=1&bgcolor=%23D50000&ctz=America%2FChicago&src=ZjlnZWhoOGdscXJ1dDVlNTJrZDZhaGlsdWtAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ&color=%23AD1457&showCalendars=0&showTabs=0&showPrint=0&showDate=1"
width="90%" height="700" frameBorder="0" scrolling="no"></iframe>}
</div>
<div id="GCalFrameDecoy" style={{ display: 'none' }}>
{this.props.onDecoyCalendar && <iframe key={this.props.decoyRefresh}
src="https://calendar.google.com/calendar/embed?height=600&wkst=1&bgcolor=%23D50000&ctz=America%2FChicago&src=ZjlnZWhoOGdscXJ1dDVlNTJrZDZhaGlsdWtAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ&color=%23AD1457&showCalendars=0&showTabs=0&showPrint=0&showDate=1"
width="90%" height="700" frameBorder="0" scrolling="no"></iframe>}
</div>
不幸的是,到目前为止,我发现无论我尝试什么,仍然会出现“闪烁”,然后iFrame左上角的字体会暂时变大(我怀疑这与刷新的时间有关:
我目前正在此处尝试设置窗口间隔:
window.setInterval(() => {
setTimeout(this.loadCalendarFrame, 3750);
setTimeout(this.loadCalendarDecoyFrame, 11250);
}
, 15000);
这里有没有人能提供一些提示/意见,也许是一种比我一直尝试的更好的方法
window.setInterval(() => {
setTimeout(this.loadCalendarFrame, 3750);
setTimeout(this.loadCalendarDecoyFrame, 11250);
}
, 15000);