Skip to content

Commit

Permalink
Scroll to top when initiating order. Use smooth behavior for both scr…
Browse files Browse the repository at this point in the history
…oll actions.
  • Loading branch information
andrewtoups committed Aug 26, 2021
1 parent 65f51e5 commit a26aabe
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/components/relics/relics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ define(['ko', 'paypal', 'api'], (ko, paypal, api) => {
let self = this;

self.buying = ko.observable(false);
self.initiateOrder = () => { self.buying(true) };
self.initiateOrder = () => {
self.buying(true);
document.querySelector('.modal-content section').scrollTo({top: 0, left: 0, behavior: 'smooth'});
};
self.cancelOrder = () => { self.buying(false) };

self.name = ko.observable("");
Expand Down Expand Up @@ -140,7 +143,7 @@ define(['ko', 'paypal', 'api'], (ko, paypal, api) => {
self.showMiniModal.subscribe(nv => {
if (nv) {
document.activeElement.blur();
setTimeout(() => { window.scrollTo(0,0) }, 50);
setTimeout(() => { window.scrollTo({top: 0, left:0, behavior: smooth}) }, 50);
self.validationWarning() && self.mmContent("validationWarning");
self.addressNotDeliverable() && self.mmContent("notDeliverable");
}
Expand Down

0 comments on commit a26aabe

Please sign in to comment.