问题
I looked at other questions regarding z-index issues in stack overflow and I was not completely understanding the concept of adding information to the end of the URL of the youtube URL ... I couldnt figure out where to begin adding wmode or why I would add that ... i just want them to NOT flow over my navigation at the top of the page ... could someone recommend a fix for my youtube videos as I use embedded youtube videos extensively on my website and having z-index issues looks amateurish and I would rather have my videos running below my nav bars if that is at all posssible. I tried setting a div and dropping the z-index but I either did it wrong or that is not a definitive fix. Help would be appreciated the URL that I am having issue with is at ... http://www.nicholaslawson.com/youtube.com ... thank you for your time.
回答1:
It's a very simple fix.
But add:
?wmode=opaque
to the end of the url. for instance:
http://youtube.com/embed/IdG0e5h3re
would become
http://youtube.com/embed/IdG0e5h3re?wmode=opaque
i had the same issue a while ago!
回答2:
This is the code i used to embed a youtube video recently
<iframe width="640" height="390" src="https://www.youtube.com/embed/PlkWVkpP59U?rel=0&modestbranding=1&wmode=transparent" frameborder="0" allowfullscreen=""></iframe>
the ID PlkWVkpP59U
is the only part you should need to change to change the video.
You can then treat the iframe as a normal element with z-index and whatever, although things typically just work once you do this
来源:https://stackoverflow.com/questions/10403124/z-index-and-youtube-videos-overlapping-content-quandry