How to subtract margin from left using jquery
Hi everyone I need to subtract the mark css
using jquery I have this script please help me. I need to subtract 200 px
var mergin = $(this).css("left") - 200;
but not work
$(this).find('.circle').click(function(){
var margin = $(this).css("left");
$('.move_plane').animate({marginLeft:margin});
});
+3
source to share
4 answers
Do you mean something like this?
$(this).css('left', "-=200");
or perhaps:
$(this).css('marginLeft', "-=200");
or just skip this step:
$('.move_plane').animate({'marginLeft': '-=200'});
Without a complete example of your code, including HTML and CSS, it's hard to tell what you really want to achieve.
+2
source to share