Comments (7)
@jcklpe @23d1 Thanks for your input. As I'm not fully aware how the other solutions are designed, and any decision made in the development of swup were made by me, I can't objectively compare simple advantages/disadvantages, so this is really helpful and will be reflected in the readme.
@Panayotov If there is something unclear in the docs, please create an issue here, or on swupjs repo, if it's rather related to the JS version.
In the meanwhile, here's a basic example using swupjs/GSAP combo I dug up from one of my projects.
const animations = {
'*': {
in: function(next){
document.querySelector('#fade').style.opacity = 0;
TweenLite.to(document.querySelector('#fade'), .5, {
opacity: 1,
onComplete: next
});
},
out: function(next){
document.querySelector('#fade').style.opacity = 1;
TweenLite.to(document.querySelector('#fade'), .5, {
opacity: 0,
onComplete: next
});
}
},
}
const options = {
debugMode: true,
animations: animations,
preload: true,
}
const swupjs = new Swupjs(options);
from swup.
This is not a priority for me at this time, but if anyone would like to go through the docs of each of mentioned tools and create some comparison for others, feel free to contact me with any questions.
from swup.
+1 Would be nice to see something like a comparison table in the readme.
from swup.
One relatively small thing that stands out to me at first glance, which dramatically helps in some cases is the fact that you can define multiple containers to swap content within. Barba for example, only lets you use the #barba-wrapper ID and .barba-container class. That means in order to replace other content on the page you need to add some custom code, which is tricky if you're not used to the pitfalls and workarounds in JavaScript. I'm probably going to switch over to SWUP from Barba for future projects. It has the same essential callbacks and hooks and many more, but even things like the nomenclature is more straight forward, which I think greatly helps people not fully comfortable in JavaScript get a head start on PJAXing their sites. Excellently executed stuff.
One huge reason to use SWUP is that it's actively maintained. Just take a look at the different repos out there with similar functionality and when anything relevant was last updated.
Edit: I actually just switched to Swup on a current project. It was a breeze, and much less code now.
from swup.
@gmrchk I guess my core question would be: why use this over turbolinks or barba.js?
This looks by far the easiest to use. I'm a designer learning to dev. So easy to use a is a big plus for me. But I don't know much else from readinging the docs on any of the other libraries.
from swup.
@23d1 Anders, can you provide some example of pages controller management with swup? I'm ditching Barbajs and looking for new pjax framework ( swup and @dogstudio/Highway are the candidates ), but the problem with both is no repos with examples ( for example simple GSAP page transition with swupjs, or page controller lifecycle and component registration ... )
If you make the switch from barba successfully some small code example ( or codesandbox.io project ) will be greatly appreciated
from swup.
I have reflected the things mentioned in this thread in some summary in the readme. Closing for now.
from swup.
Related Issues (20)
- contentReplaced and willReplaceContent being fired on the homepage
- Triggering link:click twice seems to interfere with content:replace and animation:in HOT 3
- Cannot use import outside of modules
- @swup/js-plugin: ^3.1.1 and @swup/scripts-plugin: ^2.0.0 break Astro formatting HOT 6
- Think about chances for optimizations when clicking a link during a visit HOT 9
- Suggest changes to this page links from the Documentation result in a 404 on GitHub HOT 1
- Rethink tests setup for official plugins HOT 5
- pageA goto pageB; but,with diffrent link style; when back to PageA,the links style is losted
- [Bug]: Undefined link href on Safari 13.1 and lower HOT 10
- [Feature Request]: Add way to easily listen to ALL hook events HOT 3
- [Feature Request]: Expose AbortController to be able abort request programmatically HOT 20
- Feature: Allow aborting running visits HOT 1
- Ignore errors in user hooks HOT 1
- Importing helpers from CDN module HOT 2
- History navigation ignored when using custom link selector HOT 5
- [Bug]: URL in `visit:start` inconsistent between normal and history visits HOT 4
- Feature: Store parsed html document in visit object HOT 11
- [Solved]: New values in <head> are not updated HOT 2
- [Bug]: [data-swup-ignore-script] issue with Contact Form 7 in Wordpress HOT 4
- Implement tests for official plugins
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 swup.