Displaying sumbenu over embed

Sometimes, creating a two levels menu and adding to site content embed video, submenu disappear under embed videos. A possible solution is add wmode=”opaque”. But what happens when we’re adding embed video dynamically, or we need to change dynamically all embed wmode to opaque. In this case, the possible use of jQuery library, and this script:

$(document).ready(function() {
 var embedTag;
 $(".youtube embed").each(function(i) {
 embedTag = $(this).attr("outerHTML");
 if ((embedTag != null) && (embedTag.length > 0)) {
 embedTag = embedTag.replace(/embed /gi, "embed wmode=\"opaque\" ");
 $(this).attr("outerHTML", embedTag);

Use this for firefox:

$('.youtube embed').attr('wmode','opaque');

Now give for submenu position:relative and indicate z-index (for example z-index:999) to show the submenu above this EMBED video.

Leave a Reply

Your email address will not be published. Required fields are marked *