Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <iframe width="560" height="315" src="//www.youtube.com/embed/UPk1B1bxUPg" frameborder="0" allowfullscreen></iframe>
- <iframe width="560" height="315" src="//www.youtube.com/embed/UPk1B1bxUPg/?wmode=transparent" frameborder="0" allowfullscreen></iframe>
- $str = '<iframe width="560" height="315" src="//www.youtube.com/embed/UPk1B1bxUPg" frameborder="0" allowfullscreen></iframe>';
- $dom = new DOMDocument();
- $dom->loadHTML($str);
- foreach($dom->getElementsByTagName('iframe') as $iframe) {
- $src = $iframe->getAttribute('src');
- $src .= '?wmode=transparent'; // use a regex for better results
- $iframe->setAttribute('src', $src);
- }
- echo $dom->saveHTML();
- <?php
- $videoEmbedCode = '<iframe width="560" height="315" src="//www.youtube.com/embed/UPk1B1bxUPg" frameborder="0" allowfullscreen></iframe>';
- $appendString = '/?wmode=transparent';
- /* Youtube video sticky menu overlap fix */
- $searchStartLen = strpos($videoEmbedCode, 'youtube');
- $searchEndLen = strpos($videoEmbedCode, '"', $searchStartLen);
- $newVideoEmbedCode = substr_replace($videoEmbedCode, $appendString, $searchEndLen, 0);
- print $newVideoEmbedCode;
- ?>
- $doc = new DOMDocument();
- $doc->loadHTML($your_html);
- foreach($doc->getElementsByTagName('iframe') as $iframe)
- {
- $iframe->setAttribute("src",$iframe->getAttribute('src').'?wmode=transparent');
- }
- echo $doc->saveHTML();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement