javascript - If statement is not working inside click/swipe event -


i trying use if statement inside jquery event not worknig. code:

 $(".carousel").swipeleft(function(){              rightpos += 242;              $(this).animate({ "right": rightpos }, swipespeed);              var currentrightpos = $(".carousel").css("right");              alert(currentrightpos);              if(currentrightpos > 500){                  alert("its 500");             };          }); 

i dont know happening. if statement not working inside click event. swipe event working fine. alert(currentrightpos); working fine if statement not working. have read through 5-6 questions in stackoverflow nothing helpful. if need further information please comment. thank you.

$(".carousel").css("right") returns 'npx'.

try with:

var currentrightpos = parseint($(".carousel").css("right").replace(/px/, '')); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -