Created
December 22, 2011 20:54
-
-
Save chrisvanpatten/1511820 to your computer and use it in GitHub Desktop.
Revisions
-
chrisvanpatten revised this gist
Apr 1, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ <title>jQuery Fullscreenr Sample</title> <script type="text/javascript" src="jquery.fullscreenr.js"></script> <script type="text/javascript"> $('#imageid').fullscreenr({width: 1229, height: 768}); </script> </head> <body> -
chrisvanpatten created this gist
Dec 22, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ /** * Fullscreenr - lightweight full screen background jquery plugin * By Jan Schneiders * www.nanotux.com * * Modifications by Chris Van Patten * http://www.vanpattenmedia.com * Version 1.5 **/ (function($){ $.fn.fullscreenr = function(options) { var defaults = { width: 1280, height: 1024 }; var options = $.extend({}, defaults, options); return this.each(function () { $(this).fullscreenrResizer(options); }) } $.fn.fullscreenrResizer = function(options) { // Set bg size var ratio = options.height / options.width; // Get browser window size var browserwidth = $(window).width() + 80; var browserheight = $(window).height(); // Scale the image if ((browserheight/browserwidth) > ratio){ $(this).height(browserheight); $(this).width(browserheight / ratio); } else { $(this).width(browserwidth); $(this).height(browserwidth * ratio); } // Center the image // $(this).css('left', (browserwidth - $(this).width())/2); // $(this).css('top', (browserheight - $(this).height())/2); return this; } })( jQuery ); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8"> <title>jQuery Fullscreenr Sample</title> <script type="text/javascript" src="jquery.fullscreenr.js"></script> <script type="text/javascript"> $('#imageid img').fullscreenr({width: 1229, height: 768}); </script> </head> <body> <header> <h1>jQuery Fullscreenr Sample</h1> </header> <section> <img src="images/image.jpg" alt="Just a test" id="imageid"> </section> </body> </html>