4,090
edits
No edit summary Tag: Manual revert |
No edit summary Tag: Reverted |
||
Line 2: | Line 2: | ||
// Log a message to the console | // Log a message to the console | ||
console.log('JavaScript is working!'); | console.log('JavaScript is working!'); | ||
// Hide the show-article-wrapper initially | |||
$('#show-article-wrapper').css('display', 'none'); | |||
// Find all elements with class "card" | // Find all elements with class "card" | ||
Line 15: | Line 18: | ||
console.log('Clicked on card:', this); | console.log('Clicked on card:', this); | ||
// Show the fixed column | // Show the fixed column wrapper | ||
$('#show-article').css('display', 'block'); | $('#show-article-wrapper').css('display', 'block'); | ||
// Update the fixed column content with card information | // Update the fixed column content with card information | ||
Line 49: | Line 52: | ||
'<p class="article-description">' + description + '</p>' | '<p class="article-description">' + description + '</p>' | ||
); | ); | ||
}); | }); | ||
// Attach a click event listener to close the fixed column | // Attach a click event listener to close the fixed column | ||
$('#show-article').on('click', function (event) { | $('#show-article-wrapper').on('click', function (event) { | ||
// Hide the fixed column when clicked outside or on the close button | // Hide the fixed column when clicked outside or on the close button | ||
if (event.target.id === 'close-button' || !$.contains( | if (event.target.id === 'close-button' || !$.contains($('#show-article')[0], event.target)) { | ||
$('#show-article-wrapper').css('display', 'none'); | |||
$('#show-article').css('display', 'none'); | |||
} | } | ||
}); | }); |