Skip to content

Commit

Permalink
Update mediaSlider.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ledangtrung committed Dec 2, 2024
1 parent 55a19c3 commit a708cf1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js/mediaSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class MediaSlider {
}

createMediaElement(url) {
if (!url) {
return `<i class="bi bi-file-earmark-x" title="Not available"></i>`;
}
const mediaType = this.detectMediaType(url);
switch(mediaType) {
case 'image':
Expand All @@ -124,7 +127,7 @@ class MediaSlider {

createSlider() {
if (this.mediaUrls.length === 0) {
document.getElementById(this.containerId).innerHTML = '<div>No media available</div>';
document.getElementById(this.containerId).innerHTML = '<div><i class="bi bi-file-earmark-x" title="Not available"></i></div>';
return; // Exit if there are no media URLs
}

Expand Down

0 comments on commit a708cf1

Please sign in to comment.