I'm using jquery backstretch and horizontal scrolling. Why does it jump back to the left when I call $.backstretch('next')? -


i've recreated stripped version of i'm doing here:

http://jsfiddle.net/xk7u2/11/

html:

<div class="placeholder"></div> 

css:

html, body {     width: 100%;     height: 100%; }  .placeholder {     width: 300%;     height: 100%;     background: rgba(0,0,0,0.2); } 

js:

$(function() {      $.backstretch(       [           'http://lorempixel.com/1000/1000/',           'http://lorempixel.com/1200/1000/',           'http://lorempixel.com/1000/1200/'       ]     );      $.backstretch("pause");      $(window).scroll(function (e) {         if ($(window).scrollleft() > 250) {             $.backstretch("next");         }     });  }); 

when scroll horizontally past 250px (sometimes) jumps scrollbar left start when backstretch image changes. may have try few times before happens.

can tell me why , how might prevent happening?

i've found problem:

backstretch has code fix ios problem:

/*  * scroll page 1 pixel right window height on ios  * pretty harmless else  */ if ($(window).scrolltop() === 0 ) {   window.scrollto(0, 0); } 

because we're scrolling horizontally , not vertically, scrolltop() 0, scrolls 0,0

although doubt else find problem, in future :)


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -