zoukankan      html  css  js  c++  java
  • H5_0030:iframe 全屏嵌入,父级获取iframe中嵌入的dom对象

                var i = document.getElementById("popup");
                if (this.link) {
                    g_currentHot = this, i.style.display = "block", i.classList.add("wait");
                    var n = document.createElement("iframe");
                    g_bgAudio && g_bgAudio.pause();
                    // console.log(this.link);
                    //热点点击方法
                    var r = this.link.substring(this.link.indexOf("html") + 4),
                        o = "en" == manage.number("lang") ? "&lang=" + manage.number("lang") : "";
                         - 1 == r.indexOf("?") ? n.src = this.link + "?time=" + randomTime().getTime() + "&id=" + window.number + o : 
                         n.src = this.link + "&time=" + randomTime().getTime() + "&id=" + window.number + o, n.id = "id1", 
                         n.allowTransparency = "true";
    
                    var a = document.getElementById("id1");
                    // console.log(r);
                    if (void 0 === a || null == a) {
                        document.querySelector(".popup-content").appendChild(n);
                        var s = !1;
                        window.loaddingSuccess = function() {
                            s = !0
                        }, setTimeout(function e() {
                            if (s) {
                                //得到iframe对象后,就可以通过contentWindow得到iframe包含页面的window对象,然后就可以正常访问页面元素了;
                                var t = document.querySelector("#id1").contentWindow.document;
                                t.querySelector("video") && (t.querySelector("video").play(), 
                                !t.querySelector("video").paused && t.querySelector(".playPause") && t.querySelector(".playPause").classList.add("fa-pause")), 
                                t.querySelector("audio") && t.querySelector("audio").play()
                            } else setTimeout(e, 300)
                        }, 800)
                    }
                }
    琥珀君的博客
  • 相关阅读:
    机器学习笔记[保持更新]
    习题 7-3 uva211
    习题 7-2 uva225(回溯)
    习题7-1 uva 208(剪枝)
    poj2331 (IDA*)
    poj2449 (第k条最短路)
    POJ 1324(BFS + 状态压缩)
    hdu3567 八数码(搜索)--预处理
    poj 1367 robot(搜索)
    例 7-10 uva12212(迭代加深搜索)
  • 原文地址:https://www.cnblogs.com/eliteboy/p/12439176.html
Copyright © 2011-2022 走看看