Skip to content

Commit

Permalink
Added working html5 video demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Pezzi committed Mar 7, 2011
1 parent d528a4a commit e904bd2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
29 changes: 29 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">

<title>jQuery Back Stretch</title>

</head>
<body>

<div id="page">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

</div>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="../jquery.backstretch.js"></script>

<script type="text/javascript">
$(function(){
$.backstretch('http://houseandhome.com/files/video/tv/s02/e64/michelle-hanna.mp4', { speed: 10000 });
});
</script>

</body>
</html>
6 changes: 3 additions & 3 deletions jquery.backstretch.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
if(src) {
var container = $("<div />").attr("id", "backstretch")
.css({left: 0, top: 0, position: "fixed", overflow: "hidden", zIndex: -9999}),
img = $("<img />").css({position: "relative", display: "none"})
.bind("load", function(e) {
img = $('<video autoplay="autoplay" />').css({position: "relative", display: "none"})
.bind("play", function(e) {
var self = $(this);
imgRatio = $(e.target).width() / $(e.target).height();

Expand Down Expand Up @@ -73,7 +73,7 @@
if(settings.centeredX) $.extend(bgCSS, {left: "-" + bgOffset + "px"});
}

$("#backstretch img").width( bgWidth ).height( bgHeight ).css(bgCSS);
$("#backstretch video").width( bgWidth ).height( bgHeight ).css(bgCSS);
} catch(err) {
// IE7 seems to trigger _adjustBG before the image is loaded.
// This try/catch block is a hack to let it fail gracefully.
Expand Down

1 comment on commit e904bd2

@shadesofgraywpg
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this only works for really old versions of backstretch. I could be wrong - but does this apply to a more current version?

Please sign in to comment.