|
|
| Linha 17: |
Linha 17: |
| } ); | | } ); |
| } )( jQuery ); | | } )( jQuery ); |
|
| |
|
| |
| //Js para autoplay e mostrar preview
| |
|
| |
| $('.video-teste-final').each(function() {
| |
| var $container = $(this);
| |
| var videoId = $container.data('video-id');
| |
| var thumbUrl = 'https://img.youtube.com/vi/' + videoId + '/maxresdefault.jpg';
| |
|
| |
| // Coloca a imagem de fundo via JS para não brigar com o parser do Wiki
| |
| $container.css({
| |
| 'background-image': 'url(' + thumbUrl + ')',
| |
| 'background-size': 'cover',
| |
| 'background-position': 'center'
| |
| }).find('.aviso-teste').hide();
| |
|
| |
| $container.on('mouseenter', function() {
| |
| var iframe = $('<iframe>', {
| |
| src: 'https://www.youtube.com/embed/' + videoId + '?autoplay=1&mute=1&controls=0&modestbranding=1',
| |
| width: '100%', height: '100%', frameborder: 0,
| |
| allow: 'autoplay; encrypted-media',
| |
| style: 'position:absolute; top:0; left:0; pointer-events:none;'
| |
| });
| |
| $container.append(iframe);
| |
| }).on('mouseleave', function() {
| |
| $container.find('iframe').remove();
| |
| });
| |
| });
| |
| console.log("Teste de Hover Ativado!");
| |