I need to reverse of the following code. How can I make the animation run if the width is NOT 500px.
$(".image-div").not(this).each(function() { if ($(this).css('width') == '500px') { $(this).animate({ width: '250px' }, 500, function() { // Animation complete. }); } });
In other words, what the opposite of this?: ==
Thanks
22.6k4 58 91. 41. == => != === => !== Equal and its opposite.
The equal-to operator ( == ) returns true if both operands have the same value; otherwise, it returns false . The not-equal-to operator ( != ) returns true if the operands don't have the same value; otherwise, it returns false .
jQuery not() Method: This method returns elements that do not match a defined condition. This method specifies a condition. Elements that do not match the condition are returned, and those that match will be removed. Mostly this method is used to remove one or more than one elements from a group of selected elements.
The opposite of the ==
compare operator is !=
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With