admin管理员组文章数量:1222521
I am trying to set a box A to jump to the same x-position as box B. How do I do this? I tried the following but it does not work (the second line):
$("#boxa").animate({
left: $("#boxb").left
}, 1000, function() { });
});
Thanks,
Sam
I am trying to set a box A to jump to the same x-position as box B. How do I do this? I tried the following but it does not work (the second line):
$("#boxa").animate({
left: $("#boxb").left
}, 1000, function() { });
});
Thanks,
Sam
Share Improve this question asked Feb 22, 2011 at 0:49 SamSam 1531 gold badge1 silver badge4 bronze badges2 Answers
Reset to default 34either
$('#boxB').css('left');
or
$('#boxB').offset().left;
For properties specified in pixels, using:
$('#boxB').css('padding-left');
gives a string like: '22px'
Maybe it's better to use:
parseInt($('#boxB').css('padding-left'), 10);
in such cases, which gives a number like 22 .
本文标签: javascriptHow to get the value of a CSS property using JQueryStack Overflow
版权声明:本文标题:javascript - How to get the value of a CSS property using JQuery? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1737993875a2046047.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论