-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
module.js
55 lines (41 loc) · 2.08 KB
/
module.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/** Get started
Download the latest release:
[`github.com/stephband/slide-show/releases`](https://github.com/stephband/slide-show/releases)
Then include the JS and CSS files:
```html
<link rel="stylesheet" href="./build/slide-show.css" />
<script type="module" src="./build/slide-show.js"></script>
```
You can now use the `<slide-show>` in your HTML. The `<slide-show>` example
above looks something like this:
```html
<slide-show autoplay loop controls="navigation pagination fullscreen">
<img src="./images/donkeys.jpg" draggable="false" />
<img src="./images/tractor.jpg" draggable="false" />
<img src="./images/mauverin.jpg" draggable="false" />
</slide-show>
```
A `<slide-show>` lays out its children horizontally, by default in `grid` layout.
Content is horizontally scrollable via touch or trackpad, draggable with a mouse
(making it a Good Idea to add `draggable="false"`to images and links), and also
navigable via keyboard focus.
A `<slide-show>` is not just for images. Content may be any HTML. Here's a
`<slide-show>` being employed as tabbed navigation:
<slide-show class="tab-slide-show">
<a class="tab-button button" href="#1" draggable="false">Explore</a>
<a class="tab-button button active" href="#2" draggable="false">Buy</a>
<a class="tab-button button" href="#3" draggable="false">Free trial</a>
<a class="tab-button button" href="#4" draggable="false">About</a>
<a class="tab-button button" href="#5" draggable="false">Student discount</a>
<a class="tab-button button" href="#6" draggable="false">Contact us</a>
</slide-show>
**/
// Polyfill Element.scrollTo() for Safari
// Not needed since Safari 14:
// https://caniuse.com/?search=scrollto
//import 'dom/polyfills/element.scrollto.js';
import element from 'dom/element.js';
import lifecycle from './modules/lifecycle.js';
import properties from './modules/properties.js';
lifecycle.shadow = `<link rel="stylesheet" href="${ window.slideshowStylesheet || import.meta.url.replace(/module\.js$/, 'shadow.css') }"/>`;
export default element('slide-show', lifecycle, properties, 'stephen.band/slide-show/');