Can anyone tell me why the conditional in my code is never true?
Solved:
It’s because I was checking a string against a number and needed to use parseInt()
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to
parseInt():$('.zeppelin').css('right')will return[integer]px. Therefore you are comparing a string type to an integer type.Try:
Also, as a side note, looking through your code, you have:
If you wish to invert an integer, multiply it by
-1instead: