0

I'm using jquery and my code is like this:

$(window).scroll(function(){
  var bottom = $("div#theid").offset();

  if ( bottom.top - $(window).scrollTop() < 650 ) {
  //do something here
  }

});

so when scroll down the browser, will do something, this works just fine on desktop browser, but not on mobile browser, but if I rotate my phone , this code will work, very strange. Why this strange thing happen? Thank you!

2
  • Add few debug lines somewhere, make a div and append text to it or something Commented Sep 27, 2013 at 23:19
  • Please explain the "very strange" code attitude. Commented Sep 27, 2013 at 23:32

1 Answer 1

1

Because when you rotate your phone, the var buttom variable changes which effects jQuery to function.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.