How can I make iframe respect z-index in IE?

前端 未结 4 1353
南笙
南笙 2021-01-03 22:50

I have a youtube iframe element in my website, but it\'s next to my menu items. When I hover over a menu item, a submenu opens that partially covers the iframe (because of i

4条回答
  •  执笔经年
    2021-01-03 23:10

    Here is a non pure JS solution, alternative to JQuery:

    var iFramesOnPage = document.getElementsByTagName("IFRAME");
    for(var i = 0; i < iFramesOnPage.length; i++) { 
        var newiFrameURL = iFramesOnPage[i].getAttribute("src")+"?wmode=transparent"; 
        iFramesOnPage[i].setAttribute("src", newiFrameURL);
    };
    

提交回复
热议问题