Anchor links jumping to project home page

Description
thomasVA
Posts: 1
Joined: Wed Aug 09, 2017 9:45 pm

Anchor links jumping to project home page

Postby thomasVA » Wed Aug 09, 2017 10:14 pm

Hi all,

I'm new to polarion and getting stuck on an early script I'm trying out:
(scope: using a 'script' block from a LivePage).

I'm trying to use html anchor links to create a hyperlink to a section on the same page like this:

Code: Select all

<a href="#myanchor">description of the target</a>
where I want the link and

Code: Select all

<a id="myanchor"></a>
near the target

When I test the link I get the following behavior:
1. the page does indeed jump to the correct section of the page (so far so good)
2. immediately after the page jumps to the project home page (.../polarion/#/home)

I think the last action occurs because the link is pointing to an non-existing address: ".../polarion/#myanchor" according to my browser.

Any thoughts on how I get behavior 2 not to occur?

simonbentley
Posts: 2
Joined: Tue May 07, 2019 3:57 pm

Re: Anchor links jumping to project home page

Postby simonbentley » Tue May 07, 2019 4:15 pm

Hello, did you ever find a solution to this? I am having the same issue. Anchor tags seem to misbehave and cause redirects and screen reloading.

SteffPoint
Posts: 77
Joined: Wed Mar 07, 2018 1:06 pm
Location: Germany

Re: Anchor links jumping to project home page

Postby SteffPoint » Fri May 10, 2019 6:34 am

I am experiencing the same behaviour. That's why I recommend following alternative:

You basically need two script blocks.

The script block you want to jump from:

Code: Select all

<button onclick="myFunction()">Click me</button>

<script>
function myFunction() {
document.querySelector('.hello').scrollIntoView({
  behavior: 'smooth'
});
}
</script>


and the script block you want to jump to:

Code: Select all

<div class="hello">asdasd</div>


I have tested it with current version of Chrome and for me it is working fine.

Let me know if that helped you.


Return to “Polarion Application Lifecycle Management (ALM)”

Who is online

Users browsing this forum: No registered users and 8 guests