YouTube and Shadowbox.js overlay z-index

I had a problem while working on a new site. The site has YouTube videos embedded on the page with an IFRAME tag. YouTube uses flash to display these videos, and it was showing over the top of the Shadowbox overlays. I tried z-index, but this did not work. With a bit of looking I found that the flash wmode was not set to transparent. Here is the solution:

Add a parameter to the end of the YouTube embed url in the iframe tag.

If there are no parameters at the end, use this:


If there are paremeters like ?rel=0 add it to the end with an ampersand:


Replacing this with PHP and preg_replace would be something similar to this:

$youtube_replaced = preg_replace('/("[A-Za-z0-9-]*)(.*?)(")/', '${1}${2}?wmode=transparent&rel=0${4}', $string);

The above example will set all of the YouTube paremeters window mode=transparent and related videos = 0, like this:



Visit sunny St. George, Utah, USA

Get In Touch

We would love to hear from you.

Please enter your email address.
Please enter a valid email address.
Please enter a message.
Please check your message for any errors.
Your message has been sent successfully.
Sorry, an error occured sending your message.
* required