Last active
August 29, 2015 14:06
-
-
Save nicastelo/150aa81ba6bd01d555c0 to your computer and use it in GitHub Desktop.
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
var iSelected = jQuery('.idiom-s'); | |
//Cuando el usuario hace click en algún idioma | |
iSelected.click(function(){ | |
//Declaramos y/o definimos variables | |
var changed; | |
var fPlayer = document.getElementById('player-embed'); | |
var vFrame = document.getElementsByTagName('iframe')[0]; | |
//if(vFrame.src != this.getAttribute('url')){ | |
//Escondemos el iframe | |
jQuery('iframe:first').fadeOut(); | |
//Mostramos que está cargando | |
jQuery('#player-embed').append("<i class='fa fa-play-circle fa-spin'></i>"); | |
//Cambiamos la src del iframe por la del idioma clickeado | |
vFrame.src = this.getAttribute('url'); | |
//Le decimos que ya cambió | |
changed = true; | |
//Cuando el iframe esté precargado... | |
document.getElementsByTagName('iframe')[0].onload = function(){ | |
//Lo mostramos y borramos el mensaje de carga | |
reShow(); | |
}; | |
//Si pasados 7 segundos, no ha cargado, lo mostramos igual | |
setTimeout(function(){ | |
reShow(); | |
}, 7000); | |
function reShow(){ | |
jQuery('#fCarga').remove(); | |
jQuery('iframe:first').fadeIn('slow'); | |
} | |
//} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment