4,554
edits
No edit summary |
No edit summary |
||
Line 88: | Line 88: | ||
console.log("Button or Filters div not found with jQuery."); | console.log("Button or Filters div not found with jQuery."); | ||
} | } | ||
function updateBorder() { | |||
console.log("Running updateBorder function"); | |||
// Remove the border from all items first | |||
$('#list-list div.filtered-list-item').css('border-bottom', 'none'); | |||
console.log("Removed bottom border from all items"); | |||
// Filter only items that are truly visible and not hidden by CSS | |||
var visibleItems = $('#list-list div.filtered-list-item').filter(function() { | |||
return $(this).css('display') !== 'none'; | |||
}); | |||
console.log("Number of truly visible items:", visibleItems.length); | |||
// If there's only one visible item, add the border | |||
if (visibleItems.length === 1) { | |||
visibleItems.css('border-bottom', '1px solid black'); | |||
console.log("Added bottom border to the single visible item"); | |||
} else { | |||
console.log("More than one item visible, no bottom border added"); | |||
} | |||
} | |||
// Delegate the mousedown event to the '.card' elements inside the '#list' container | // Delegate the mousedown event to the '.card' elements inside the '#list' container | ||
$('#list').on('mousedown', '.card', function (event) { | $('#list').on('mousedown', '.card', function (event) { |