Comments (4)
My PR includes basic instructions for this: #61
from swipe.
Hmm... Dynamic content can be achieved by first destroying the existing Swipe instance and then creating a new one after dynamically playing with the content of the slider.
Basically,
window.mySwipe1 = new Swipe(elem, options);
mySwipe1.kill();
/* dynamically add slides HERE */
window.mySwipe2 = new Swipe(elem, options});
// repeat this cycle every time slides are added, ideally erasing each Swipe instance after `kill()`
I acknowledge, this creates a lot of overhead.
@axelson In your PR, you're making an exception for the setup behavior only for the startSlide
option. I would suggest making it possible to pass an (optional) options
parameter to the setup()
method, which could override the initial configuration (passed when creating a Swipe instance). This could be very helpful, since it could be desirable to alter some options over time without having to create a new Swipe instance every time.
I think extending (generalizing) this way of altering the configuration to all options is a better design approach (rather than relying on exceptions). Please feel free to share your thoughts! 😄
from swipe.
Yeah I think that makes sense, just wasn't sure how much work it would be to set all the options again. But perhaps if we extracted it to a new method, something like configureOptions
then that could be used both in the setup
case as well as the new
case.
from swipe.
Yes, this configureOptions
could be abstracted to a private (internal) method. However, I'm afraid such a design change will be a good deal of work considering the way Swipe is already built: the configuration options seem to be pretty much spread out accross the different parts of Swipe. I'll have to look into the code and see if it is actually possible to do this in Swipe!
from swipe.
Related Issues (20)
- Zoom does not work HOT 1
- Add configurable selector for children to use as a slides HOT 1
- Recalculate widths without changing inline css transition duration HOT 9
- slide(index, duration) does not work HOT 2
- enhancement: add 3 missing props to React documentation HOT 2
- Each slide appears diagonally below the one before it HOT 5
- Question: Is there a way to make what is inside of swipe wrap also clickable? HOT 1
- method of judging amd may cause error:Cannot set property 'Swipe' of undefined
- Multiple Swipe instances? HOT 1
- Using {passive: true} may causes the problem of event conflict on Safari HOT 1
- overlapping slides HOT 2
- A few suggestions HOT 1
- Clicked ignored elements are prevented from default behavior
- Layout is broken if swipe widget is disabled
- react 版本的需要更新一下,升级到16.13.1,应该是16.8以后,componentWillReceiveProps 不建议使用了,等到17就正式不让使用了,麻烦更新一下。 HOT 1
- Layout jump after init HOT 2
- Flex direction row-reverse not working? HOT 1
- continuous为true且children个数为两个时显示有问题 HOT 1
- Desktop weirdness... HOT 1
- slide function directions HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swipe.