javascript - jQuery How to check if the current position of a div is equal to -



javascript - jQuery How to check if the current position of a div is equal to -

i stuck. working on jquery game , need know current position of object , check if equals 0. tryed different things never work.. here code:

function movepoint() { $( '.point' ).each( function() { if($(this).attr('id').position().left == 0) { console.log("yay!"); } $( ).css( 'left', $( ).position().left - ( speed + (roundsclicked / 10) ) ); console.log("left position of element - " + $(this).position().left); }); }

just alter code

function movepoint() { $( '.point' ).each( function() { if($(this).position().left == 0) {// if($(this).css('left') == '0px') console.log("yay!"); } $( ).css( 'left', $( ).position().left - ( speed + (roundsclicked / 10) ) ); console.log("left position of element - " + $(this).position().left); }); }

javascript jquery html css

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -