diff options
| author | Jesse Morgan <jesse@jesterpm.net> | 2013-10-18 15:18:06 -0700 | 
|---|---|---|
| committer | Jesse Morgan <jesse@jesterpm.net> | 2013-10-18 15:18:06 -0700 | 
| commit | 794de015acd0328cf71ca925c9c7be8a86079fb5 (patch) | |
| tree | ab4765405175bf568ef40bd4a9eb012eb0073e3b /web/scripts | |
| parent | d85a261b9c29ef6362167e54fe1977b1c0451fdf (diff) | |
Improving closing videos20131018a
Diffstat (limited to 'web/scripts')
| -rw-r--r-- | web/scripts/growth.js | 18 | 
1 files changed, 17 insertions, 1 deletions
diff --git a/web/scripts/growth.js b/web/scripts/growth.js index de10d45..d4cee5b 100644 --- a/web/scripts/growth.js +++ b/web/scripts/growth.js @@ -144,6 +144,10 @@ function playVideo(videoId)          }          var player = $('#videoplayer video')[0]; +        if (typeof player.canPlayType !== 'function') { +            notice("Your browser does not support html5 videos. Please try another browser or contact us."); +        } +          for (var i in data.urls) {              var video = data.urls[i];              if (player.canPlayType(video.type) != '') { @@ -169,6 +173,12 @@ function displayPlayer()      $("body").animate({backgroundColor: '#181818'}, 500, 'linear', function(){          $("#videoplayer").fadeIn(200);      }); + +    $(document).keyup('displayPlayer.exit', function(e) { +      if (e.keyCode == 27) { +          closeVideo(); +      } +    });  }  function reportVideoComplete(data) @@ -203,11 +213,17 @@ function reportVideoComplete(data)  function closeVideo()  { -    $("#videoplayer video")[0].pause(); +    var player = $('#videoplayer video')[0]; +    if (typeof player.pause === 'function') { +        player.pause(); +    } +      $("#videoplayer").fadeOut(100);      $("body").animate({backgroundColor: '#FFFFFF'}, 500, 'linear', function(){          $("#content").fadeIn(200);      }); + +    $(document).unbind('displayPlayer.exit');  }  function chapterComplete()  | 
