iframe z-index dropdown menu

白昼怎懂夜的黑 提交于 2019-12-12 10:14:43

问题


Due to the structure of my website, I am forced to use a iframe to display the dropdown menu html file. if not, I am not able to see the dropdown in IE. Here is the code I am using:

<iframe id="a"name="FRAMENAME" src="http://website.com/dropdown.html" 
width="1000" style="position:relative" background="#F3F0ED" style="z-index:10000" 
height="40" frameborder="0" scrolling="no" allowautotransparency=true></iframe>

Now the problem is that the dropdown is hiding behind the other images on the website. I have specified position:relative and z-index:10000 but I cannot get it to overlap on the images. The z-index of these images is much less than 10000. Any suggestions please?


回答1:


if your images are outside of your iFrame, of course your dropdown menu will not show up since you are trying to tell the dropdown menu to go out of its windows. iframe is a different window inside your html, therefore any overflow of the window will never go out, elements inside the iframe is not affected with the z-index.

what you could do is, if your http://website.com/dropdown.html has the dropdown content only, you can call it by jQuery

<div id="myDropDown">
</div>


<script type="text/javascript">
    $(document).ready(function() {
        $("#myDropDown").load("http://website.com/dropdown.html");
    });    
</script>

this will append the content of your dropdown.html into the div




回答2:


Just add "wmode=transparent" after "?"

don't remember!! set Property dropdown z-index too.



来源:https://stackoverflow.com/questions/3225139/iframe-z-index-dropdown-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!