Guest User

Untitled

a guest
Nov 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. <script>
  2. var youtube = "https://www.youtube.com/embed/"
  3. $("button[data-url]").click(function() {
  4. var code = $(this).data("url")
  5. var video = youtube + code
  6. $("iframe").attr("src", video)
  7. })
  8. </script>
  9.  
  10. <button type="button" data-url="WhateverCode1">Video 1</button>
  11. <button type="button" data-url="WhateverCode2">Video 2</button>
  12.  
  13. <!--With src="" is so much faster -->
  14. <div class="embed-responsive embed-responsive-16by9">
  15. <iframe class="embed-responsive-item" src=""></iframe>
  16. </div>
  17.  
  18. <!-- Than no src -->
  19. <div class="embed-responsive embed-responsive-16by9">
  20. <iframe class="embed-responsive-item"></iframe>
  21. </div>
Add Comment
Please, Sign In to add comment