diff --git a/src/jquery.backstretch.js b/src/jquery.backstretch.js index 4dacae0..d540493 100644 --- a/src/jquery.backstretch.js +++ b/src/jquery.backstretch.js @@ -134,9 +134,12 @@ * Root: Convenience reference to help calculate the correct height. */ this.$container = $(container); - this.$wrap = $('
').css(styles.wrap).appendTo(this.$container); this.$root = this.isBody ? supportsFixedPosition ? $(window) : $(document) : this.$container; + // Don't create a new wrap if one already exists (from a previous instance of Backstretch) + var $existing = this.$container.children(".backstretch").first(); + this.$wrap = $existing.length ? $existing : $('').css(styles.wrap).appendTo(this.$container); + // Non-body elements need some style adjustments if (!this.isBody) { // If the container is statically positioned, we need to make it relative,