eWriter -- anchor to top

Please post all questions on Help+Manual 8 here

Moderators: Alexander Halser, Tim Green

Post Reply
John Johann
Posts: 305
Joined: Mon Aug 21, 2017 7:35 pm

eWriter -- anchor to top

Unread post by John Johann »

I created some anchors in a topic to avoid having to scroll.
At a certain point in the topic, I have 3 topic links to the same topic with the name of the anchor.
Beside each of the three jump targets, I created a topic link to the same topic with the default (Top).

When I publish to eWriter, I can jump down to the anchors but not back to the top.
When I publish to CHM, I can jump up and down :hoorahb:

Do I need to define a custom anchor for the top of the page for eWriter?
User avatar
Tim Green
Site Admin
Posts: 7819
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: eWriter -- anchor to top

Unread post by Tim Green »

Hi John,

You're using a V3 or V4 skin, where this won't work quite the same because of the way topics are referenced. However, you can easily create a scroll to top link, it's just a little different. Instead of creating a regular topic link, create a script link and enter this code in the Script: box:

Code: Select all

javascript:hmpage.$scrollBox.scrollTo(0, 600)
The first value is the vertical position, the second is the number of milliseconds that the scroll operation should take. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
John Johann
Posts: 305
Joined: Mon Aug 21, 2017 7:35 pm

Re: eWriter -- anchor to top

Unread post by John Johann »

Hi Tim,
I copy/pasted the code but receive a blank page with [object Object] when I build and click on the link.

I then replaced "hmpage" with the name of the topic page (without extension) -- nothing happens when I build and click on the link.

I'm using the Minimalist blue eWriter skin (modified some colours and CI).
User avatar
Tim Green
Site Admin
Posts: 7819
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: eWriter -- anchor to top

Unread post by Tim Green »

Hi John,

You're probably using the wrong link type, otherwise you won't see the Object display. See here:
ScriptLink.png
You do not have the required permissions to view the files attached to this post.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
John Johann
Posts: 305
Joined: Mon Aug 21, 2017 7:35 pm

Re: eWriter -- anchor to top

Unread post by John Johann »

Hi Tim,
That's exactly how I have set it -- no joy.
I've now just inserted a normal anchor at the top of the page and link to it. That works fine so it's not really an issue as long as I don't forget :-).
User avatar
Tim Green
Site Admin
Posts: 7819
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: eWriter -- anchor to top

Unread post by Tim Green »

John Johann wrote: Wed Jan 05, 2022 10:50 am That's exactly how I have set it -- no joy.
I've now just inserted a normal anchor at the top of the page and link to it. That works fine so it's not really an issue as long as I don't forget :-).
Oops, thanks for reporting this. I only did a quick check in WebHelp, since it's the same code. It's a problem with script links with some kinds of content in eWriter. The Windows WebView component apparently doesn't like script links with a certain kind of characters in them. Here's how to solve this:

Edit the hm_webhelp.js file in the skin and locate this line of code:

Code: Select all

jQuery.cachedScript = function( url, options ) {
Then add this code directly ABOVE it:

Code: Select all

  // Scroll to top for script link use
   var ScrollTop = function() {
	   hmpage.$scrollBox.scrollTo(0,600);
   }
Then for your script links to scroll to the top use:

Code: Select all

javascript:ScrollTop();
I'm going to add the ScrollTop function to the scripts in the next update, so you will be able to go on using it without any changes. 8)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Post Reply