Created
April 21, 2012 02:50
-
-
Save fedmich/2433422 to your computer and use it in GitHub Desktop.
Javascript - Hide elements like iframe, embedded objects on the page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Hides iframe from youtube, embedded objects | |
*/ | |
function hide_other_elements(){ | |
var iframes = document.getElementsByTagName('iframe'); | |
jQuery(iframes).each(function(){ | |
if( (this.src + '').match('http://www.youtube.com/embed/') ){ | |
jQuery( this ).parent().addClass('hidden_elements'); | |
} | |
}); | |
var objects = document.getElementsByTagName('object'); | |
jQuery(objects).each(function(){ | |
jQuery( this ).parent().addClass('hidden_elements'); | |
}); | |
} | |
/* add in your CSS */ | |
.hidden_elements{ | |
visibility:hidden; | |
} | |
.hidden_elements iframe{ | |
visibility:hidden; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment