div {
margin-left: 20px; }
However when I am using the following jQuery code to extract this margin left property value by using the left property, all I am getting is auto, whereas I expect 20px:
var $m= ($("div").css("left"));
I know that this is a valid property because I have seen a few animation examples in some jQuery books where an element is moved towards the right over a period of time by setting a final position for the left-margin of the element in this way:
var paraWidth = $('div.speech p').outerWidth();
var $switcher = $(this).parent();
var switcherWidth = $switcher.outerWidth();
$switcher.animate({left: paraWidth - switcherWidth,
height: '+=20px', borderWidth: '5px'}, 'slow');
Can anybody tell me how to extract the value 20px?
This post has been edited by cupidvogel: 08 February 2011 - 12:48 PM

New Topic/Question
Reply



MultiQuote




|