Here's a piece of code that I need some help with. The issue occurs when clicking on a box to expand it and display more information. Most of the time, it works fine, but occasionally if an image is not cached, clicking again to minimize the box causes it to pop back out instead of resizing properly. I suspect this may be related to the following line:
if($(this)[0].style.width == '70%'){
If you need more context or want to try replicating the problem, you can visit:
Try searching for a few games and interacting with the results to see the issue in action. Thank you.
$container.on("click", ".box", function (event) {
var description;
var user_id;
var org_img = $(this).find("img").attr("src");
if ($(this)[0].style.width == '70%') {
$(this).find("img").attr("src", org_img);
$(this).css('width', '18%');
$(this).find(".resultData").fadeOut('slow');
$container.masonry('reload');
} else {
var me = this;
value['name'] = $(me).find("p").html();
oldImage = $(this).find("img").attr("src");
$.ajax({
url: 'scripts/php/fetchResultsData.php',
data: {
action: value
},
type: 'post',
dataType: 'json',
success: function (data) {
// Data processing logic here
}
});
}
});