Scroll to anchor with offset from external page jQuery

Scroll to anchor with offset from external page jQuery

When need to Developing a website it’s important that all anchor links are working. Also if those links Scholl to anchor to the exact Location with a offset value that would be really cool thing.

Recently i have worked in a site for my client, She need all the Anchor link Scroll to the exact Location with smooth scrolling effect.

So all are working good but when i trying to Scroll to anchor from external page that was really a challenge for me. After some Research Found some useful Code.

Place the above code before </body> tag. You can Change the offset value and swing target value. Scroll to anchor with offset from external page can doen by jQuery. it’s Really an easily fix by adding the JQuery code with a Smooth Scrolling effect.

Md. Elias
elias1435@gmail.com
2 Comments
  • Damian Szydłowski
    Posted at 01:36h, 25 March Reply

    Thank you! It helped me a lot. But i have a question. Is there a way to make it wait for page to load, and then scroll to anchor?

    • Md. Elias
      Posted at 15:24h, 06 April Reply

      Sorry for late reply. Yes you can do that but you need to use a Page load plugin or a function. Also you need to assign a a id on the link it will scroll to the exact point.

Post A Comment