D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
mattborn
Full window
Github gist
iFrame Play Button
<!doctype html> <html> <head> <title>iframe Play Button</title> <style> @import "https://cdn.rawgit.com/mattborn/a9ceb96ad80f586cf40145276f98b86c/raw/713948588a471f22349744ff76d899fedbdb1577/bambu.css"; iframe { border: none; max-width: 100%; } .video { height: 0; padding: 0 0 56.25%; /* 16:9 */ position: relative; } .video-iframe, .video-play { height: 100%; left: 0; position: absolute; top: 0; width: 100%; } .video-play { align-items: center; color: white; cursor: pointer; font-size: 100px; display: flex; justify-content: center; pointer-events: none; } .video:hover .video-play { color: #11a7aa; } </style> </head> <body> <div class="video"> <iframe class="video-iframe" src="https://www.facebook.com/video/embed?video_id=10154064015005318"></iframe> <div class="video-play"> <i class="video-play-icon fa fa-youtube-play"></i> </div> </div> <script> focus(); document.querySelectorAll('.video').forEach(function (el) { const listener = addEventListener('blur', function () { const play = el.querySelector('.video-play'); if (play && document.activeElement === el.querySelector('.video-iframe')) { el.removeChild(play); } removeEventListener('blur', listener); }); }); </script> </body> </html>