jQuery - If ( "A" left value is equal to "B" width minus "C" width )
Title says it well:
If ( element-A
's left value is equal to element-B
's width m开发者_JS百科inus element-C
's width )
http://jsfiddle.net/UAKXq/1
What am I doing wrong?
This one is correct
if (parseInt(A.css('left')) == B.width() - C.width()) {
http://jsfiddle.net/UAKXq/14/
use this
if(parseInt(A.css('left')) == (B.width() - C.width()))
if( parseInt(A.css('left'),10) === parseInt(B.css('width'), 10) - parseInt(C.css('width'), 10)) {
$('body').css({ background: 'red' });
}
http://jsfiddle.net/UAKXq/20/
精彩评论