php - How to return to original scroll position after submitting a form using javascript? -
how can automatically scroll position of button after submitting form?
function scrolltobuttonposition(x,y){ window.scrollto(x,y); }
how call function , pass current scroll coordinates when click submit button?
you have few options achieve that.
- use ajax submit form script. scroll position maintained
- on submit save scroll position local storage , on load if item in local storage, if scroll , delete item in local storage. if not, page didn't loaded due form submission.
- using
a
anchor. submit form script append anchor form action url.
using ajax best option. appending anchor easiest implement.
fiddle anchor: https://fiddle.jshell.net/vaxdu4n7/9/show/
Comments
Post a Comment