splidejs / splide-extension-auto-scroll Goto Github PK
View Code? Open in Web Editor NEWThe Splide extension for continuously scrolling the slider.
Home Page: https://splidejs.com/
License: MIT License
The Splide extension for continuously scrolling the slider.
Home Page: https://splidejs.com/
License: MIT License
0.5.3
Script returning error.
Below is the script that loads the splide.
$(".splide.media-scroller", context).once("splide-init").each(function () {
new Splide($(this).get(0), {
type: 'loop',
drag: 'free',
focus: 'center',
perPage: 3,
autoScroll: {
speed: 0.5,
},
gap: "1.5rem",
pagination: false,
arrows: false,
padding: "1.5rem",
mediaQuery: 'min',
fixedWidth: '65%',
breakpoints: {
576: {
fixedWidth: "41%",
},
992: {
fixedWidth: "30%",
},
1200: {
fixedWidth: "17%",
},
}
}).mount(window.splide.Extensions);
});
No response
$(".splide.media-scroller", context).once("splide-init").each(function () {
new Splide($(this).get(0), {
type: 'loop',
drag: 'free',
focus: 'center',
perPage: 3,
autoScroll: {
speed: 0.5,
},
gap: "1.5rem",
pagination: false,
arrows: false,
padding: "1.5rem",
mediaQuery: 'min',
fixedWidth: '65%',
breakpoints: {
576: {
fixedWidth: "41%",
},
992: {
fixedWidth: "30%",
},
1200: {
fixedWidth: "17%",
},
}
}).mount(window.splide.Extensions);
});
There shouldnt be any javascript error.
v0.4.2
According to the documentation, I have added the AutoScroll extension.
import { Splide } from '@splidejs/splide';
import { AutoScroll } from '@splidejs/splide-extension-auto-scroll';
new Splide( '.splide' ).mount( { AutoScroll } );
After importing AutoScroll the build fails:
Property 'AutoScroll' of type 'AutoScrollComponent | undefined' is not assignable to 'string' index type 'BaseComponent'.
Is that happening only for me?
No response
No build error.
3.6.12
With the following code:
import Splide from '@splidejs/splide';
import { AutoScroll } from '@splidejs/splide-extension-auto-scroll';
export default function init () {
const slider = new Splide('.splide', {
type : 'loop',
focus : 'center',
autoWidth: true,
pauseOnHover: false,
pauseOnFocus: false,
rewind: false,
speed: 1100,
easing: 'cubic-bezier(.14,.1,.5,.7)',
easing: 'cubic-bezier(.53,.12,.36,.87)',
drag: 'free',
easingFunc: t => 1 - Math.pow(1 - t, 2),
autoScroll: {
pauseOnHover: false,
pauseOnFocus: false,
rewind: false,
speed: 1,
},
})
.mount({ AutoScroll });
}
I'm getting a "rewind" behavior when trying to click previous slide when the last slide is near the left edge, time after time.
No response
No rewind behavior, ability to switch slides further and further left
0.5.3
Currently the speed of the auto-scroll extension is specified in pixel/frame units. Unfortunately, because different devices can operate at different framerates, this can result in the slider moving at different speeds on different devices.
For example, take the demo on the Splide web site at https://splidejs.com/extensions/auto-scroll/#speed. That displays at one speed on my desktop PC (which is 60fps) and a different speed on my Google Pixel 6 (which is 90fps, but can dynamically drop lower to save battery). It does appear that it's about 50% faster on my phone than on my PC. I can send you a video if you like.
I spent many hours yesterday trying to solve this by monitoring the current framerate with fps-observer and changing the Autoscroll speed option on the fly. Unfortunately the results were not very good.
So, now I am looking at modifying the autoscroll extension in some way, to stabilize the speed across devices with different framerates. I don't have any complete solutions in mind but I have some ideas. (calculating fps by measuring the time between RequestAnimationFrame calls, averaging that over time, then using that average value to modulate the speed of the slider so it matches the speed set in the main Splide config.)
First, though, I wanted to check in with you. Does my explanation make sense? Do you think this is worth solving? Do you have any preferred/suggested way of solving it? I can fumble my way through it and submit a PR, but if you have some more elegant way of approaching it, then I would love to hear your thoughts.
Thanks!
No response
I expect to see the two sliders moving at the same speed. It is, I believe, reasonable for a designer to want the user experience to have that level of consistency across multiple devices.
0.3.3
The splide autoscroll would initialize properly but then freeze and either freeze completely (unless hovered upon) or jerk back to the starting slide (rewind option is set to false)
The console throws up this exact error when it happens
Uncaught TypeError: e.Slides.update is not a function
at ln (splide-extension-auto-scroll.min.js:6)
at cn (splide-extension-auto-scroll.min.js:6)
at i (splide-extension-auto-scroll.min.js:6)
My html structure is as below:-
<div id="franchise-gallery" class="splide">
<div id="franchise-gallery-container" class="splide__track">
<ul id="franchise-gallery-list" class="splide__list">
<li class="franchise-gallery-slide splide__slide loaded"><img src="1.jpg"></li>
<li class="franchise-gallery-slide splide__slide loaded"><img src="2.jpg"></li>
<li class="franchise-gallery-slide splide__slide loaded"><img src="3.jpg"></li>
</ul>
</div>
</div>
And my script code is as below:-
var gallery = new Splide('#franchise-gallery',{
type : 'loop',
drag: 'free',
autoWidth: true,
pagination: false,
arrows: false,
autoScroll: {
speed: 0.5,
rewind: false,
autoStart: true,
pauseOnHover: true
}
}).mount(window.splide.Extensions);
const { Autoplay } = gallery.Components;
* Also tried v3.4 but the script wont even start:-
splide-extension-auto-scroll.cjs.min.js:13 Uncaught ReferenceError: exports is not defined
at splide-extension-auto-scroll.cjs.min.js:13
No response
Scrolling smoothly and wrapping around to the 1st slide again
v0.5.3
Methods of splide-extension-auto-scroll
are not working. Below is sample code for reference.
NOTE:
@splidejs/splide = 4.1.4
@splidejs/splide-extension-auto-scroll = v0.5.3
import { Splide } from "@splidejs/splide";
import { AutoScroll } from "@splidejs/splide-extension-auto-scroll";
const carousel = new Splide(document.querySelector(".splide"), {
type: "loop",
gap: "20px",
drag: "free",
pagination: false,
arrows: false,
autoScroll: {
speed: -0.5,
pauseOnHover: false,
pauseOnFocus: false,
},
});
carousel.mount({ AutoScroll });
// !!! NOT WORKING !!!
/** Should ideally pause the carousel, but it is not?? */
carousel.Components.AutoScroll.pause();
https://codesandbox.io/p/devbox/splide-autoscroll-issue-cgg4v4
N/A
Should pause & play with respective methods.
v4.1.4
So basic splide JS works for me perfectly. But then I tried to use this extension for autoscroll and it doesn't work for me. I don't know where is the issue. Everything with pathing should be OK. Could you tell me where am I doing a mistake? I copied normal splide autoscroll file. And in the console, there aren't any errors. So? I am obviously using code for [CDN](https://splidejs.com/extensions/auto-scroll/#cdn-or-hosting-files). I am using this on Localhost. Also I tried to add this extension to the header... But again nothing.
No response
...
Any tips for how to make it work?
0.5.3
When I clone this repo and run npm install
to install dependencies, it results in the following error messages about a broken ts-jest dependency. I was able to resolve this and get the dependencies to install cleanly using npm update ts-jest
. I will submit a PR for this issue momentarily.
2023-05-03T16:10:59.829Z
While resolving: [email protected]
Found: [email protected]
node_modules/babel-jest
dev babel-jest@"^29.0.1" from the root project
babel-jest@"^29.0.1" from [email protected]
node_modules/jest-config
jest-config@"^29.0.1" from @jest/[email protected]
node_modules/@jest/core
@jest/core@"^29.0.1" from [email protected]
node_modules/jest
dev jest@"^29.0.1" from the root project
@jest/core@"^29.0.1" from [email protected]
node_modules/jest-cli
jest-cli@"^29.0.1" from [email protected]
node_modules/jest
dev jest@"^29.0.1" from the root project
jest-config@"^29.0.1" from [email protected]
node_modules/jest-cli
jest-cli@"^29.0.1" from [email protected]
node_modules/jest
dev jest@"^29.0.1" from the root project
Could not resolve dependency:
peerOptional babel-jest@"^28.0.0" from [email protected]
node_modules/ts-jest
dev ts-jest@"next" from the root project
Conflicting peer dependency: [email protected]
node_modules/babel-jest
peerOptional babel-jest@"^28.0.0" from [email protected]
node_modules/ts-jest
dev ts-jest@"next" from the root project
Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.
No response
npm install
I expect npm install
to complete without errors.
v0.3.7
stops after scrolling on slide and dose not restart after interaction like this https://splidejs.com/extensions/auto-scroll/
https://codesandbox.io/s/splide-test-iy87td?file=/index.html
excepted behavior should be like this example https://splidejs.com/extensions/auto-scroll/
v4.0.2
Seems like whatever (body, wrapping div, div.splide) have CSS attribute transform: rotate(Xdeg)
it slows down autoscroll and eventually stop it.
No response
transform: rotate(5deg)
to slider or even bodyAutoscroll would work normally.
v4.0.1
Below is the code I tried using to get the slider to scroll in different direction. It works for a while, but after all images are scrolled once, they just dissapear.
var splide = new Splide("#splidelower", { type: "loop", focus: "center", rewind: true, arrows: false, pagination: false, drag: false, pauseOnHover: false, perPage: 5, autoScroll: { speed: -0.8, pauseOnHover: false, }, }); splide.mount(window.splide.Extensions);
No response
Images should not be disappearing
v0.5.2
Negative values (reverse scroll) will not work if SplideJS type is set to "slide". If we use positive value, it will work fine.
Also, if it is set to "loop", everything work as expected.
https://codesandbox.io/s/643-forked-le7c7g?file=/src/index.js
Auto Scroll should work from beginning. Now it only works, if we move slider to last image, then it will start to scroll (on negative values).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.