MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 127: Line 127:
                 currentIndex = (currentIndex + 1) % totalImages;
                 currentIndex = (currentIndex + 1) % totalImages;
                 var image = images[currentIndex];
                 var image = images[currentIndex];
                 // Update only the image part, not the entire content
                 var articleImageContainer = $('#article-content').find('.article-images');
                $('#article-content').find('.article-image').html(getImageHtml(image, currentIndex, totalImages));
                articleImageContainer.html(getImageHtml(image, currentIndex, totalImages));
             }
             }
          
          
Line 135: Line 135:
                 toggleImage();
                 toggleImage();
             });
             });
           
         }
         }
          
          
         function getImageHtml(image, currentIndex, totalImages) {
         function getImageHtml(image, currentIndex, totalImages) {
             var imageLabel = (currentIndex + 1) + '/' + totalImages + ' IMAGES';
             var imageLabel = (currentIndex + 1) + '/' + totalImages + ' IMAGES';
             return '<div class="image-container">' +
             return '<div class="article-images">' +
                      '<img src="' + image.src + '" alt="' + image.alt + '">' +
                      '<p class="article-label-image">' + imageLabel + '</p>' +
                      '<div class="' + image.captionClass + '">' + image.caption + '</div>' +
                      '<div class="image-container">' +
                  '</div>' +
                          '<img src="' + image.src + '" alt="' + image.alt + '">' +
                   '<p class="article-label-image">' + imageLabel + '</p>';
                          '<div class="' + image.captionClass + '">' + image.caption + '</div>' +
         }      
                      '</div>' +
                   '</div>';
         }  
          
          
         // Attach a mousedown event listener to close the fixed column
         // Attach a mousedown event listener to close the fixed column

Navigation menu