tibewww tibewww - 1 year ago 56
Javascript Question

On new page, scrolling down to a specific div automatically

Quite simple,

I would like on click, to arrive to a specific section on a new page.


should work,
being the ID of the section.

However, the menu I'm using is breaking this. Si I'm trying to see if it's possible to do this by Jquery, using Hash. ( When url have this hash example www.myd0main.com/page/#contact - do this)

SO far I tried the following:

jQuery(document).ready(function() {

if (window.location.hash.split('-')[0] == '#contact') {


Withotu any sucess.

Do you guys have any turnaround / idea to make this work ?

It will be lovely !

Thank you !

Answer Source


if (window.location.hash == '#contact') {
  // Scroll to #contact