Comments (4)
Very nice point! This is a new feature which I actually haven't even used yet, so thank for a heads up.
I've added support for including a hash (id of the element) in the action attribute of the form, so the page will scroll to your form after sending and getting the reply.
<form action="#form" id="form" data-swup-form>
I would also suggest disabling swup's scroll on submit and enabling it after the page is reloaded, so it does not move at all when sending the form.
swup.options.scroll = false
from swup.
Thanks that's awesome! Will give it a try tomorrow. Would it be possible to elaborate a bit on the code required for your second point?
I would also suggest disabling swup's scroll on submit and enabling it after the page is reloaded, so it does not move at all when sending the form.
from swup.
Sure! The easiest way to disable scrolling for forms would be...
document.addEventListener('swup:formSubmit', event => {
swup.options.scroll = false;
});
document.addEventListener('swup:animationInDone', event => {
swup.options.scroll = true;
});
Didn't test it, hope there are no typos or something... but you get the idea.
from swup.
Yep that was just the ticket thank you! Slight typo, final code below in case anyone else wants to do the same:
document.addEventListener('swup:submitForm', function() {
swup.options.scroll = false;
});
document.addEventListener('swup:animationInDone', function() {
swup.options.scroll = true;
});
from swup.
Related Issues (20)
- 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
- [Feature Request]: Add drop-in attribute to swap/replace content of elements outside the swup container HOT 4
- Slim down core
- [Idea]: New plugin for all route-related stuff HOT 1
- [Idea]: Put core plugins inside swup's main repo HOT 4
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.