Created
October 15, 2010 14:39
-
-
Save diodoe/628283 to your computer and use it in GitHub Desktop.
Revisions
-
diodoe renamed this gist
Oct 15, 2010 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
diodoe revised this gist
Oct 15, 2010 . 1 changed file with 2 additions 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 @@ -1,6 +1,7 @@ //Adjust image size //needs jquery //put a #grid and #resizeme on your html and call $('#resizeme').resizeimg() $.fn.resizeimg = function() { //Define starting width and height values for the original image var startwidth = 1280; var startheight = 960; -
diodoe created this gist
Oct 15, 2010 .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,31 @@ //Adjust image size //needs jquery $.fn.resizenow = function() { //Define starting width and height values for the original image var startwidth = 1280; var startheight = 960; //Define image ratio var ratio = startheight/startwidth; //Gather browser dimensions var browserwidth = $(window).width(); var browserheight = $(window).height(); //Resize image to proper ratio if ((browserheight/browserwidth) > ratio) { $(this).height(browserheight); $(this).width(browserheight / ratio); $('#grid').height(browserheight); $('#grid').width(browserheight / ratio); $(this).children().height(browserheight); $(this).children().width(browserheight / ratio); } else { $(this).width(browserwidth); $(this).height(browserwidth * ratio); $('#grid').width(browserwidth); $('#grid').height(browserwidth * ratio); $(this).children().width(browserwidth); $(this).children().height(browserwidth * ratio); } //Make sure the image stays center in the window $(this).children().css('left', (browserwidth - $(this).width())/2); $(this).children().css('top', (browserheight - $(this).height())/2); };