First of all, you are not using $img variable . Therefore, the callback function is not required in the first.
The callback function may have been enabled here if you are completely resizing the image.
jQuery('.square-section').hover(function(){ jQuery(this).fadeTo('slow',0.3); }, function() { jQuery(this).fadeTo('slow',1); });
Check feed
If you want to change 2 different images, you can try this approach
jQuery('.square-section').hover(function(){ jQuery(this).fadeTo('slow', 0.3, function() { jQuery('.square', this).removeClass('square-chess').addClass('square-chart'); jQuery(this).fadeTo('fast', 1); }); }, function() { jQuery(this).fadeTo('fast', 0.3, function() { jQuery('.square', this).removeClass('square-chart').addClass('square-chess'); jQuery(this).fadeTo('fast', 1); }); });
Script with 2 images
jQuery('.square-section').hover(function () { jQuery('.square', this).removeClass('square-chess').addClass('square-chart'); }, function () { jQuery('.square', this).removeClass('square-chart').addClass('square-chess'); });
source share