@jocampo3/slider 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/package.json +1 -1
- package/styles.css +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,8 @@ import Slider from '@jocampo3/slider';
|
|
|
21
21
|
import '@jocampo3/slider/styles.css';
|
|
22
22
|
|
|
23
23
|
const interval = 3500; // update to your interval value
|
|
24
|
-
const slider =
|
|
24
|
+
const slider = document.getElementById('my-slider');
|
|
25
|
+
new Slider(slider, interval);
|
|
25
26
|
```
|
|
26
27
|
|
|
27
28
|
### Multiple Sliders
|
|
@@ -33,12 +34,13 @@ import '@jocampo3/slider/styles.css';
|
|
|
33
34
|
const interval = 3500; // update to your interval value
|
|
34
35
|
const slides = document.querySelectorAll('.slideshow');
|
|
35
36
|
|
|
36
|
-
slides.forEach(s => new Slider(s, interval)
|
|
37
|
+
slides.forEach(s => new Slider(s, interval);
|
|
37
38
|
```
|
|
38
39
|
|
|
39
40
|
## Example
|
|
40
41
|
```html
|
|
41
|
-
|
|
42
|
+
<!-- NOTE: To enable buttons, include the 'js-buttons' class on the slideshow div -->
|
|
43
|
+
<div class="slideshow js-buttons">
|
|
42
44
|
<figure>
|
|
43
45
|
<!-- self-referenced link -->
|
|
44
46
|
<a id="a-classic" href="#a-classic">
|
|
@@ -65,6 +67,7 @@ Slider uses native CSS scroll snap for positioning and smooth scrolling transiti
|
|
|
65
67
|
- Zero dependencies
|
|
66
68
|
- Native scroll snap positioning
|
|
67
69
|
- Smooth scroll transitions
|
|
70
|
+
- Button Support
|
|
68
71
|
|
|
69
72
|
## License
|
|
70
73
|
|
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.slideshow,.slideshow>* a{width:100%;height:100%;display:flex}a{text-decoration:none}.slideshow{overflow-x:scroll;overflow-y:hidden;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;scrollbar-width:none}.slideshow::-webkit-scrollbar{display:none}.slideshow:hover{scroll-behavior:smooth}.slideshow>*{position:relative;scroll-snap-align:
|
|
1
|
+
.slideshow :first-child a:before,.slideshow :last-child a:after,.slideshow:after,.slideshow:before{display:none}.slideshow,.slideshow>* a{width:100%;height:100%;display:flex}.slideshow.js-buttons::after,.slideshow.js-buttons::before{display:block;font-size:2em;background:#aaa;opacity:0.8;padding:8px 15px;border-radius:100%;position:absolute;top:50%;transform:translateY(-50%);cursor:pointer;z-index:5;pointer-events:none;}.slideshow.js-buttons::before{content:'<';left:10px}.slideshow.js-buttons::after{content:'>';right:10px}a{text-decoration:none}.slideshow{overflow-x:scroll;overflow-y:hidden;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;scrollbar-width:none;}.slideshow::-webkit-scrollbar{display:none}.slideshow:hover{scroll-behavior:smooth}.slideshow>*{position:relative;scroll-snap-align:center;flex-shrink:0;width:70%;height:100%;margin:0 15%}.slideshow>* a{align-items:center;justify-content:center;-webkit-tap-highlight-color:transparent}.slideshow a>*{max-width:100%;max-height:100%;object-fit:contain;z-index:1}.slideshow a:focus-visible{outline:0}.slideshow a:after,.slideshow a:before{z-index:2;content:"";display:block;position:absolute;top:0;bottom:0;width:calc(50% + 4vw)}.slideshow a:before{left:calc(-1 * calc(50% + 4vw))}.slideshow a:after{right:calc(-1 * calc(50% + 4vw))}
|