Reputation: 23593
Is it possible to add an if statement to jQuery so when you click an element a function only runs if another div has the CSS value of left: 1%?
Later on the CSS may change and I would need it so when you click an element the first function does not to not fire, but for a different one does.
Upvotes: 2
Views: 4063
Reputation: 11544
Check out this fiddle:
Note that there is position:absolute for the element. Without that jquery always returns the value as 'auto'
Upvotes: 0
Reputation: 14166
if ($('.className').css('left') == '1%')
alert('do something');
Upvotes: 6