The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Jumping down the page
Brian Chandler
post Sep 7 2021, 02:07 AM
Post #1


Jocular coder
********

Group: Members
Posts: 2,476
Joined: 31-August 06
Member No.: 43



In my checkout shipping selection, I have buttons to go to the payment page, but I also want a "Contact" ("Ask"... not decided) button which jumps down the page to the contact form. In a simple case I would just use <a href="#contact">Contact us</a> (or similar), but I want to use JS to copy the current selection into the contact form (no problem), *then* jump down. What is the neatest way to do this? The method using an anchor and <a> is not entirely satisfactory, because the browser tends to position the (notional position of the) anchor precisely at the top of the screen -- it would be much nicer to get the form sensibly positioned on the screen. And it would be neater to do the jump in JS, to avoid having to add an <a> element.

Grateful for any suggestions - thanks!
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Brian Chandler
post Sep 8 2021, 02:37 AM
Post #2


Jocular coder
********

Group: Members
Posts: 2,476
Joined: 31-August 06
Member No.: 43



Many thanks Christian. I will look at the docs for this - I just discovered that it is on page 590 of my (ancient) JS book, amazingly found by looking in the index for "scroll". (O'Reilly book by David Flanagan; the index is spectacularly useless in general, since it is not in alphabetical order. But once you know what the answer is, it's easy to find.)
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 21st September 2024 - 06:45 PM