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
Post a Comment