Skip to content

Commit

Permalink
Added max-width: none to img so that it would be more friendly with B…
Browse files Browse the repository at this point in the history
…ootstrap.
  • Loading branch information
srobbin committed Jun 8, 2012
1 parent 14ce02f commit 6af4c97
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
38 changes: 19 additions & 19 deletions jquery.backstretch.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* jQuery Backstretch
* Version 1.2.7
* Version 1.2.8
* http://srobbin.com/jquery-plugins/jquery-backstretch/
*
* Add a dynamically-resized background image to the page
*
* Copyright (c) 2012 Scott Robbin (srobbin.com)
* Licensed under the MIT license
* https://raw.github.com/srobbin/jquery-backstretch/master/LICENSE.txt
*
*
*/

;(function($) {
Expand All @@ -27,10 +27,10 @@

// Extend the settings with those the user has provided
if(options && typeof options == "object") $.extend(settings, options);

// Just in case the user passed in a function without options
if(options && typeof options == "function") callback = options;

$(document).ready(function() {
/*
* Taken from jQuery Mobile 1.1.0
Expand All @@ -42,7 +42,7 @@
* jQuery Mobile uses this workaround. It's not ideal, but works.
*
* Modified to detect IE6
*/
*/
var w = window
, ua = navigator.userAgent
, platform = navigator.platform
Expand All @@ -55,7 +55,7 @@
, omversion = !!operammobilematch && operammobilematch[ 1 ]
, iematch = ua.match( /MSIE ([0-9]+)/ )
, ieversion = !!iematch && iematch[ 1 ];

supportsFixedPosition = !(
// iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5)
(( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1 || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534 )
Expand All @@ -80,25 +80,25 @@
// IE6
( ieversion && ieversion <= 6)
);

// Set the root element
rootElement = supportsFixedPosition ? $(window) : $(document);

// Should we use the window's innerHeight?
useWindowInnerHeight = supportsFixedPosition && window.innerHeight;
useWindowInnerHeight = supportsFixedPosition && window.innerHeight;

// Initialize the plugin
_init();
});

// For chaining
return this;

function _init() {
// Prepend image, wrapped in a DIV, with some positioning and zIndex voodoo
if(src) {
var img;

// If this is the first time that backstretch is being called
if($container.length == 0) {
$container = $("<div />").attr("id", "backstretch")
Expand All @@ -107,12 +107,12 @@
// Prepare to delete any old images
$container.find("img").addClass("deleteable");
}
img = $("<img />").css({position: "absolute", display: "none", margin: 0, padding: 0, border: "none", zIndex: -999999})
.bind("load", function(e) {

img = $("<img />").css({position: "absolute", display: "none", margin: 0, padding: 0, border: "none", zIndex: -999999, maxWidth: "none"})
.bind("load", function(e) {
var $self = $(this),
imgWidth, imgHeight;

$self.css({width: "auto", height: "auto"});
imgWidth = this.width || $(e.target).width();
imgHeight = this.height || $(e.target).height();
Expand All @@ -127,7 +127,7 @@
});
})
.appendTo($container);

// Append the container to the body, if it's not already there
if($("body #backstretch").length == 0) {
/*
Expand All @@ -137,10 +137,10 @@
if ($(window).scrollTop() === 0 ) window.scrollTo(0, 0);
$("body").append($container);
}

// Attach the settings
$container.data("settings", settings);

img.attr("src", src); // Hack for IE img onload event

// Adjust the background size when the window is resized or orientation has changed (iOS)
Expand All @@ -153,7 +153,7 @@
});
}
}

function _adjustBG() {
try {
bgCSS = {left: 0, top: 0}
Expand Down Expand Up @@ -181,5 +181,5 @@
}
}
};

})(jQuery);
6 changes: 3 additions & 3 deletions jquery.backstretch.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6af4c97

Please sign in to comment.