Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. // Listen for the ready event for any vimeo video players on the page
  2. var vimeoPlayers = document.querySelectorAll('iframe'),
  3. player;
  4.  
  5. for (var i = 0, length = vimeoPlayers.length; i < length; i++) {
  6. player = vimeoPlayers[i];
  7. $f(player).addEvent('ready', ready);
  8. }
  9.  
  10. /**
  11. * Utility function for adding an event. Handles the inconsistencies
  12. * between the W3C method for adding events (addEventListener) and
  13. * IE's (attachEvent).
  14. */
  15. function addEvent(element, eventName, callback) {
  16. if (element.addEventListener) {
  17. element.addEventListener(eventName, callback, false);
  18. }
  19. else {
  20. element.attachEvent(eventName, callback, false);
  21. }
  22. }
  23.  
  24. /**
  25. * Called once a vimeo player is loaded and ready to receive
  26. * commands. You can add events and make api calls only after this
  27. * function has been called.
  28. */
  29. function ready(player_id) {
  30. // Keep a reference to Froogaloop for this player
  31. var container = document.getElementById(player_id).parentNode.parentNode,
  32. froogaloop = $f(player_id),
  33. apiConsole = container.querySelector('.console .output');
  34.  
  35. /**
  36. * Prepends log messages to the example console for you to see.
  37. */
  38. function apiLog(message) {
  39. apiConsole.innerHTML = message + 'n' + apiConsole.innerHTML;
  40. }
  41.  
  42. // Setup clear console button
  43. var clearBtn = container.querySelector('.console button');
  44. addEvent(clearBtn, 'click', function(e) {
  45. apiConsole.innerHTML = '';
  46. }, false);
  47.  
  48. apiLog(player_id + ' ready!');
  49. }
  50. })();
  51.  
  52. jQuery("a.switch-foto").click(function(){
  53. jQuery(".fotos").fadeOut();
  54. jQuery(".fotos").removeClass("first");
  55. jQuery('#see_'+this.id).delay(600).fadeIn();
  56. froogaloop.api('pause');
  57. });
  58.  
  59. Froogaloop( jQuery('iframe')[0] ).api('pause');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement