Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bootstrap_basic_image_gallery
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
bootstrap_basic_image_gallery
Merge requests
!5
Update 4 files
Code
Review changes
Check out branch
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
Open
Update 4 files
issue/bootstrap_basic_image_gallery-3446861:3446861-thumbnail-hover-not
into
8.x-1.x
Overview
0
Commits
1
Pipelines
0
Changes
4
Open
Update 4 files
Scot Hubbard
requested to merge
issue/bootstrap_basic_image_gallery-3446861:3446861-thumbnail-hover-not
into
8.x-1.x
May 13, 2024
Overview
0
Commits
1
Pipelines
0
Changes
4
/bootstrap_basic_image_gallery.libraries.yml
/js/hover_preview.js
/js/lazyload.js
/js/hover_preview_media.js
Closes
#3446861
0
0
Merge request reports
Compare
8.x-1.x
8.x-1.x (HEAD)
and
latest version
latest version
c3b86953
1 commit,
May 13, 2024
4 files
+
21
−
22
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
js/hover_preview.js
+
4
−
5
View file @ 77ba851e
Edit in single-file editor
Open in Web IDE
Show full file
@@ -10,13 +10,12 @@
@@ -10,13 +10,12 @@
attach
:
function
attach
(
context
,
settings
)
{
attach
:
function
attach
(
context
,
settings
)
{
// Find each thumbnail.
// Find each thumbnail.
once
(
'
hover_preview
'
,
'
.bootstrap-basic-image-gallery .thumb
'
,
context
).
forEach
((
item
,
index
)
=>
{
once
(
'
bs-gallery-hover
'
,
'
.bootstrap-basic-image-gallery .thumb
'
).
forEach
(
element
=>
{
// On hover, exchange the main image with the thumbnail image.
element
.
addEventListener
(
'
mouseover
'
,
e
=>
{
$
(
item
).
on
(
'
mouseover
'
,
function
(
ev
)
{
// Get the thumbnail being hovered.
// Get the thumbnail being hovered.
var
thumbnailContainer
=
$
(
e
v
.
currentTarget
);
var
thumbnailContainer
=
$
(
e
.
currentTarget
);
// Find the main image div.
// 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.
// Set the source to be the source from the thumbnail.
mainContainer
.
find
(
'
img
'
).
attr
(
'
src
'
,
thumbnailContainer
.
find
(
'
img
'
).
data
(
'
mainsrc
'
));
mainContainer
.
find
(
'
img
'
).
attr
(
'
src
'
,
thumbnailContainer
.
find
(
'
img
'
).
data
(
'
mainsrc
'
));
// Set the slide-to.
// Set the slide-to.
Loading