-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initial setup on thumbnail carousel with working example #198
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,6 +197,9 @@ js/modules/combobox.js: | |
js/modules/enable-carousel.js: | ||
16: import '../node_modules/glider-js/glider.js'; | ||
|
||
js/modules/enable-thumbnail-carousel.js: | ||
16: import '../node_modules/@splidejs/splide/dist/js/splide.min.js'; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot this file exists. Please delete it. It is not needed anymore (all tickets are now in github Issues). |
||
js/modules/enable-listbox.js: | ||
16: import accessibility from '../../node_modules/accessibility-js-routines/dist/accessibility.module.js'; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<section class="enable-thumbnail-carousel" aria-labelledby="thumbnail-carousel-heading"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's call this page thumbnail-gallery.php |
||
<h2 id="thumbnail-carousel-heading">Image Thumbnails Navigation Carousel Working Example</h2> | ||
<div class="enable-thumbnail-carousel__wrapper"> | ||
<!-- Primary Slider Start--> | ||
<div | ||
id="main-carousel" | ||
class="splide enable-thumbnail-carousel__main" | ||
aria-label="The carousel with thumbnails. Selecting a thumbnail will change the Beautiful Gallery carousel."> | ||
<div class="splide__track"> | ||
<ul class="splide__list"> | ||
<li class="splide__slide"> | ||
<img src="images/carousel-example/00-turkish-spider-man.jpg" | ||
alt="Bootleg versions of Spider-Man, Captain America and El Santo fighting." /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this example, I'd like to use product shots for something. I don't want to use the same images from another example. |
||
</li> | ||
<li class="splide__slide"> | ||
<img src="images/carousel-example/02-turkish-star-wars.jpg" | ||
alt="Cüneyt Arkın kicking and fighting two beasts that look like they are in low budget furry costumes, while a woman being held by one of them looks on in awe." /> | ||
</li> | ||
<li class="splide__slide"> | ||
<img src="images/carousel-example/01-samurai-cop.jpg" | ||
alt="A man with a mullet and a maniacal face holding a sword in the middle of a field." /> | ||
</li> | ||
<li class="splide__slide"> | ||
<img src="images/carousel-example/03-lady-terminator.jpg" | ||
alt="An angry woman looking straight at the viewer with a gun blasting rounds in the same direction." /> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
<!-- Primary Slider End--> | ||
<!-- Thumbnal Slider Start--> | ||
<div | ||
id="thumbnail-carousel" | ||
class="splide enable-thumbnail-carousel__slider"> | ||
<div class="splide__track"> | ||
<ul class="splide__list"> | ||
<li class="splide__slide"> | ||
<img src="images/carousel-example/00-turkish-spider-man.jpg" | ||
alt="Bootleg versions of Spider-Man, Captain America and El Santo fighting." /> | ||
</li> | ||
<li class="splide__slide"> | ||
<img src="images/carousel-example/02-turkish-star-wars.jpg" | ||
alt="Cüneyt Arkın kicking and fighting two beasts that look like they are in low budget furry costumes, while a woman being held by one of them looks on in awe." /> | ||
</li> | ||
<li class="splide__slide"> | ||
<img src="images/carousel-example/01-samurai-cop.jpg" | ||
alt="A man with a mullet and a maniacal face holding a sword in the middle of a field." /> | ||
</li> | ||
<li class="splide__slide"> | ||
<img src="images/carousel-example/03-lady-terminator.jpg" | ||
alt="An angry woman looking straight at the viewer with a gun blasting rounds in the same direction." /> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
<!-- Thumbnal Slider End--> | ||
</div> | ||
</section> | ||
|
||
<?= includeNPMInstructions( | ||
"enable-thumbnail-carousel", | ||
[], | ||
"enable-thumbnail-carousel", | ||
false, | ||
[ | ||
"needsSplide" => true, | ||
], | ||
) ?> | ||
|
||
<script type="module"> | ||
import EnableThumbnailCarousel from "./js/modules/enable-thumbnail-carousel.js"; | ||
EnableThumbnailCarousel(); | ||
</script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<link href="~@splidejs/splide/dist/css/splide.min.css" rel="stylesheet" type="text/css" /> | ||
<link href="css/enable-visible-on-focus.css" rel="stylesheet"> | ||
<link href="css/thumbnail-carousel.css" rel="stylesheet"> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
.enable-thumbnail-carousel__wrapper { | ||
max-width: 670px; | ||
width: 100%; | ||
margin: 20px 0; | ||
padding: 20px; | ||
background: #e4e2e2; | ||
border-radius: 3px; | ||
} | ||
|
||
.enable-thumbnail-carousel__main { | ||
margin-bottom: 10px | ||
} | ||
|
||
.splide__slide img { | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
} | ||
|
||
.enable-thumbnail-carousel__slider .splide__slide { | ||
opacity: 0.6; | ||
} | ||
|
||
.enable-thumbnail-carousel__slider .splide__slide.is-active { | ||
opacity: 1; | ||
} | ||
|
||
.splide__arrow:disabled { | ||
opacity: 0.5 !important; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change this image with the new images mentioned above. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict' | ||
|
||
/******************************************************************************* | ||
* enable-thumbnail-carousel.js - Accessible shim over the Glider carousel | ||
* | ||
* Written by Zoltan Hawryluk <zoltan.dulac@gmail.com> | ||
* Part of the Enable accessible component library. | ||
* Version 1.0 released December 27, 2021 | ||
* | ||
* More information about this script available at: | ||
* https://www.useragentman.com/enable/carousel.php | ||
* | ||
* Released under the MIT License. | ||
******************************************************************************/ | ||
|
||
import '../../enable-node-libs/@splidejs/splide/dist/js/splide.min.js'; | ||
|
||
const EnableThumbnailCarousel = function () { | ||
const defaultOptions = { | ||
pagination: false, | ||
} | ||
const main = new Splide('#main-carousel', { | ||
...defaultOptions, | ||
type: 'fade', | ||
arrows: false, | ||
lazyLoading: 'sequential', | ||
}); | ||
|
||
const thumbnails = new Splide('#thumbnail-carousel', { | ||
...defaultOptions, | ||
fixedWidth: 150, | ||
gap: 10, | ||
isNavigation: true, | ||
focus: 'center', | ||
breakpoints: { | ||
'768': { | ||
fixedWidth: 125, | ||
} | ||
} | ||
}); | ||
|
||
// sync the thumbnails slider as a target of main slider. | ||
main.sync(thumbnails); | ||
main.mount(); | ||
thumbnails.mount() | ||
} | ||
|
||
export default EnableThumbnailCarousel; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure where you'd change this, but I'd like to add the following changes:
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should not be bolded. The paragraph above states:
"For example, when I added the glider-js library to Enable so I can use it in the Carousel demos, I added the files I needed for the front-end to nodeFiles with these two lines:"
Technically, what you have worked on is not a general carousel. It's an image gallery. We should change this PR to not use the word carousel, but image gallery. I'll make appropriate comments to reflect what we should change.