forked from danmillar/jquery-anystretch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reminified for version 1.1.1 release.
- Loading branch information
Scott Robbin
committed
Aug 5, 2010
1 parent
f3f518b
commit fcf1929
Showing
1 changed file
with
2 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
/* | ||
* jQuery Backstretch | ||
* Version 1.1 | ||
* Version 1.1.1 | ||
* http://srobbin.com/jquery-plugins/jquery-backstretch/ | ||
* | ||
* Add a dynamically-resized background image to the page | ||
* | ||
* Copyright (c) 2010 Scott Robbin (srobbin.com) | ||
* Dual licensed under the MIT and GPL licenses. | ||
*/ | ||
(function(a){a.backstretch=function(k,h,l){function m(c){d=e.width();b=d/i;if(b>=e.height()){f=(b-e.height())/2;g.centeredY&&a.extend(j,{top:"-"+f+"px"})}else{b=e.height();d=b*i;f=(d-e.width())/2;g.centeredX&&a.extend(j,{left:"-"+f+"px"})}a("#backstretch img").width(d).height(b).css(j);typeof c=="function"&&c()}var g={centeredX:true,centeredY:true,speed:0},e="onorientationchange"in window?a(document):a(window),i,d,b,f,j={left:0,top:0};h&&typeof h=="object"&&a.extend(g,h);a(document).ready(function(){if(k){var c=a("<div />").attr("id","backstretch").css({left:0,top:0,position:"fixed",overflow:"hidden",zIndex:-9999}),p=a("<img />").css({position:"relative",display:"none"}).bind("load",function(n){var o=a(this);i=a(n.target).width()/a(n.target).height();m(function(){o.fadeIn(g.speed,function(){typeof l=="function"&&l()})})}).appendTo(c);a("body").prepend(c);p.attr("src",k);a(window).resize(m)}});return this}})(jQuery); | ||
(function(a){a.backstretch=function(k,i,l){function m(c){f={left:0,top:0};d=e.width();b=d/j;if(b>=e.height()){g=(b-e.height())/2;h.centeredY&&a.extend(f,{top:"-"+g+"px"})}else{b=e.height();d=b*j;g=(d-e.width())/2;h.centeredX&&a.extend(f,{left:"-"+g+"px"})}a("#backstretch img").width(d).height(b).css(f);typeof c=="function"&&c()}var h={centeredX:true,centeredY:true,speed:0},e="onorientationchange"in window?a(document):a(window),j,d,b,g,f;i&&typeof i=="object"&&a.extend(h,i);a(document).ready(function(){if(k){var c=a("<div />").attr("id","backstretch").css({left:0,top:0,position:"fixed",overflow:"hidden",zIndex:-9999}),p=a("<img />").css({position:"relative",display:"none"}).bind("load",function(n){var o=a(this);j=a(n.target).width()/a(n.target).height();m(function(){o.fadeIn(h.speed,function(){typeof l=="function"&&l()})})}).appendTo(c);a("body").prepend(c);p.attr("src",k);a(window).resize(m)}});return this}})(jQuery); |