Skip to content
Snippets Groups Projects

Update 4 files

4 files
+ 21
22
Compare changes
  • Side-by-side
  • Inline
Files
4
+ 4
5
@@ -10,13 +10,12 @@
attach: function attach(context, settings) {
// Find each thumbnail.
once('hover_preview', '.bootstrap-basic-image-gallery .thumb' , context).forEach((item, index) => {
// On hover, exchange the main image with the thumbnail image.
$(item).on('mouseover', function(ev) {
once('bs-gallery-hover', '.bootstrap-basic-image-gallery .thumb').forEach(element => {
element.addEventListener('mouseover', e => {
// Get the thumbnail being hovered.
var thumbnailContainer = $(ev.currentTarget);
var thumbnailContainer = $(e.currentTarget);
// Find the main image div.
var mainContainer = $(item).parent().parent().find('.main-image');
var mainContainer = $(element).parent().parent().find('.main-image');
// Set the source to be the source from the thumbnail.
mainContainer.find('img').attr('src', thumbnailContainer.find('img').data('mainsrc'));
// Set the slide-to.
Loading