Skip to content

Commit

Permalink
Fixed bug where page scrolled to top in between slideshow slides.
Browse files Browse the repository at this point in the history
  • Loading branch information
srobbin committed May 8, 2012
1 parent 59f032e commit 14ce02f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions jquery.backstretch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* jQuery Backstretch
* Version 1.2.6
* Version 1.2.7
* http://srobbin.com/jquery-plugins/jquery-backstretch/
*
* Add a dynamically-resized background image to the page
Expand Down Expand Up @@ -85,13 +85,7 @@
rootElement = supportsFixedPosition ? $(window) : $(document);

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

/*
* Scroll the page one pixel to get the right window height on iOS
* Pretty harmless for everyone else
*/
window.scrollTo(0, 1);
useWindowInnerHeight = supportsFixedPosition && window.innerHeight;

// Initialize the plugin
_init();
Expand Down Expand Up @@ -136,6 +130,11 @@

// Append the container to the body, if it's not already there
if($("body #backstretch").length == 0) {
/*
* Scroll the page one pixel to get the right window height on iOS
* Pretty harmless for everyone else
*/
if ($(window).scrollTop() === 0 ) window.scrollTo(0, 0);
$("body").append($container);
}

Expand Down
4 changes: 2 additions & 2 deletions jquery.backstretch.min.js

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

0 comments on commit 14ce02f

Please sign in to comment.