Auto-generate a Back to Top Link?

This forum is for all Flare issues related to the HTML5, WebHelp, WebHelp Plus, and Adobe Air Targets
Post Reply
CHCR
Propeller Head
Posts: 21
Joined: Thu Oct 20, 2011 2:28 pm

Auto-generate a Back to Top Link?

Post by CHCR »

Sorry if this has been answered before — the search function thinks my terms are too generic to return any results!

Is there a way to automatically generate a Back to Top link at the bottom of each topic in Web Help? I know we're advised to keep topics short, but some of ours just can't be helped, and it would be nice if the user had a quick way to get back to the beginning.
nickatwork
Sr. Propeller Head
Posts: 457
Joined: Thu Sep 16, 2010 6:31 am
Location: London

Re: Auto-generate a Back to Top Link?

Post by nickatwork »

Have a google for 'back to top javascript' - most likely what you are after. You should be able to add this code to your master page and that will place it on every page - though it would look a little weird if it was on a short page where it wasnt required, so maybe you could just drop the code on the pages that exceed a single page length.

Good luck.
Nick
NorthEast
Master Propellus Maximus
Posts: 6426
Joined: Mon Mar 05, 2007 8:33 am

Re: Auto-generate a Back to Top Link?

Post by NorthEast »

One of our help projects uses:

Code: Select all

javascript:window.scrollTo(0,0);
(You could use that as the href or as an onclick action.)
crdmerge
Sr. Propeller Head
Posts: 248
Joined: Tue Dec 16, 2008 5:37 am

Re: Auto-generate a Back to Top Link?

Post by crdmerge »

For a non-JavaScript solution, the pound sign denotes the start of the HTM page:

<a href="#">Top of page</a>


Good luck,
Leon
CHCR
Propeller Head
Posts: 21
Joined: Thu Oct 20, 2011 2:28 pm

Re: Auto-generate a Back to Top Link?

Post by CHCR »

Thanks for the suggestions!

So..... I'm not really savvy enough to delve into code, here. I like the sound of Leon's solution because it seems the simplest. But I think I'm doing it wrong: I switched to XML view and stuck it in the code just above the </body> tag, but nothing happened...
crdmerge
Sr. Propeller Head
Posts: 248
Joined: Tue Dec 16, 2008 5:37 am

Re: Auto-generate a Back to Top Link?

Post by crdmerge »

Enclose it in a <p></p> tag container:

<p><a href="#">Top of page</a></p>

Then Save.
LTinker68
Master Propellus Maximus
Posts: 7247
Joined: Thu Feb 16, 2006 9:38 pm

Re: Auto-generate a Back to Top Link?

Post by LTinker68 »

crdmerge wrote:For a non-JavaScript solution, the pound sign denotes the start of the HTM page:

<a href="#">Top of page</a>
What happens if you have other bookmarks in that topic, including ones Flare would insert when you create a xref? Will having just the # in the href tag still work and go to the top of the page, or would it jump to the bookmark created by the xref (or toggle, etc.)?
Image

Lisa
Eagles may soar, but weasels aren't sucked into jet engines.
Warning! Loose nut behind the keyboard.
crdmerge
Sr. Propeller Head
Posts: 248
Joined: Tue Dec 16, 2008 5:37 am

Re: Auto-generate a Back to Top Link?

Post by crdmerge »

The pound sign indicates to HTML an internal link.

* If a bookmark assignment follows the pound sign (#intro_section, #config_section, etc.), you jump to the bookmark.
* If nothing follows the pound sign, you jump to the top (effectively, a file refresh).
CHCR
Propeller Head
Posts: 21
Joined: Thu Oct 20, 2011 2:28 pm

Re: Auto-generate a Back to Top Link?

Post by CHCR »

Fabulous — thanks!
Post Reply