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)
                    }
                }
    琥珀君的博客
  • 相关阅读:
    每天一道算法题(13)——使用递归颠倒栈
    每天一道算法题(12)——和为n的连续正数序列或者随机数
    函数模板
    答题总结(1)
    顶点间最短路径长度之探寻算法
    最小生成树
    new与delete,malloc与free
    C++的继承与接口
    笔记13 AOP中After和AfterReturning的区别
    笔记12 注入AspectJ切面
  • 原文地址:https://www.cnblogs.com/eliteboy/p/12439176.html
Copyright © 2011-2022 走看看