Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_wcms_ohana
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_wcms_ohana
Commits
b45a6511
Commit
b45a6511
authored
3 weeks ago
by
Martin Leblanc
Committed by
Kevin Paxman
2 weeks ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-5650: Add specificity for buttons, add hidden nav state when imagesNum match dots
parent
09369aff
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/patterns/04-components/image-gallery/_image-gallery.scss
+7
-1
7 additions, 1 deletion
src/patterns/04-components/image-gallery/_image-gallery.scss
src/patterns/04-components/image-gallery/image-gallery.js
+9
-2
9 additions, 2 deletions
src/patterns/04-components/image-gallery/image-gallery.js
with
16 additions
and
3 deletions
src/patterns/04-components/image-gallery/_image-gallery.scss
+
7
−
1
View file @
b45a6511
...
...
@@ -14,8 +14,14 @@ $size-xlarge: 7;
&
.active
{
display
:
flex
;
}
&
.hide
{
display
:
none
;
}
}
.flickity-page-dots
{
&
.hide
{
display
:
none
;
}
bottom
:
-2rem
;
.dot
{
height
:
var
(
--
size-2
);
...
...
@@ -239,7 +245,7 @@ $size-xlarge: 7;
}
&
[
data-images-num
=
"3"
]
{
.uw-ig__item
{
max-width
:
32%
;
max-width
:
32
.5
%
;
}
}
&
[
data-images-num
=
"4"
]
{
...
...
This diff is collapsed.
Click to expand it.
src/patterns/04-components/image-gallery/image-gallery.js
+
9
−
2
View file @
b45a6511
...
...
@@ -8,7 +8,6 @@
Drupal
.
behaviors
.
imagegallery
=
{
attach
:
function
()
{
// Ensure code runs after the DOM is fully loaded.
$
(
document
).
ready
(
function
()
{
...
...
@@ -30,6 +29,7 @@
contain
:
true
,
wrapAround
:
true
,
draggable
:
false
,
imagesLoaded
:
true
,
groupCells
:
function
()
{
// Adjust the number of visible images based on screen width.
var
width
=
$
(
window
).
width
();
...
...
@@ -51,8 +51,13 @@
var
flkty
=
$carousel
.
data
(
'
flickity
'
);
// Handle keyboard navigation for Flickity pagination dots.
var
dots
=
document
.
querySelectorAll
(
'
.uw-ig
.flickity-page-dots .dot
'
);
var
dots
=
$carousel
.
find
(
'
.flickity-page-dots .dot
'
)
.
toArray
()
;
// Hide the button wrapper if the number of dots equals imagesNum
if
(
dots
.
length
===
imagesNum
)
{
$
(
this
).
find
(
'
.uw-button--wrap
'
).
addClass
(
'
hide
'
);
$
(
this
).
find
(
'
.flickity-page-dots
'
).
addClass
(
'
hide
'
);
}
if
(
!
dots
.
length
)
{
return
;
}
...
...
@@ -82,11 +87,13 @@
// Previous button event listener.
$
(
'
.uw-ig-button--previous
'
).
on
(
'
click
'
,
function
()
{
var
$carousel
=
$
(
this
).
closest
(
'
.uw-ig
'
).
find
(
'
.carousel
'
);
$carousel
.
flickity
(
'
previous
'
);
});
// Next button event listener.
$
(
'
.uw-ig-button--next
'
).
on
(
'
click
'
,
function
()
{
var
$carousel
=
$
(
this
).
closest
(
'
.uw-ig
'
).
find
(
'
.carousel
'
);
$carousel
.
flickity
(
'
next
'
);
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment