Open the particular section of page second when we click on first page link

After click on link in first page open the second page and scroll down to specific section of the page. For eg First page after I click on about then open the second page and scroll down to the about section

Hello @Dhanashree,

Welcome to the builder.io forum post.

You can try using JavaScript code to resolve this issue. Please try adding the following code to the Edit Content JS + CSS section of the targeted content page where the anchor link exists, and see if it resolves the issue for you:

let sectionId = window.location.href.split('#')[1];
if(sectionId !== undefined){   
   document.getElementById(sectionId).scrollIntoView({behavior: 'smooth'});
}  

Thank you for your response. But its not working

Hello @Dhanashree,

If the proposed solution isn’t working, could you provide us with more context regarding your setup and requirements? This will allow us to offer you a more targeted solution.

See after apply your logic after click on first page link its goes only on second page not scroll down to that section.

Hello @Dhanashree,

For me to be able to help you further, could you please provide me with the Builder Content Entry link where you’re experiencing an issue this will me further my investigation?

Here is how to find it:

Hlo,

Id of
About-workforce-solution
ContactMe-staffing-recruitment

After click on About the second page open and red box , click on ContactMe the blue box open.

This are two links

Hello @Dhanashree,

To resolve this issue, you’ll need to add the shared code to the target content. Instead of using the “Edit Content JS + CSS” option, you should utilize a custom code block.

For reference, refer to the loom recording below

Thank You for your help. Its working now.