1

So I have a custom image that links to contact page. On this page, when contact is clicked from the home page it scrolls to a specific div(Contact form).

I have been searching the web and stumble into a scrollto plugin from this question but it seems it only goes a different part of the same page (not certain but it didn't work for me).

Can anyone guide me to "Create a link that traverse to another page then scroll to a specific div" thank you. An example would greatly be appreciated.

Community
  • 1
  • 1
Akyl
  • 349
  • 1
  • 4
  • 21
  • Are you looking for the page to load, and then scroll down to the div of choice?? – Aaron Miler Sep 07 '12 at 15:50
  • I want to create a special exemption onclick on a specific image that loads on a contact page then scrolls to specific div. So only when that link is clicked. – Akyl Sep 07 '12 at 15:53

3 Answers3

0

You might want to use anchors and then use # in the href to reference the name:

<a name="css-tutorials">CSS Tutorials</a>

<a href="#css-tutorials">Cascading Style Sheet Tutorials</a>

Examples were taken from here

Daniel Dinnyes
  • 4,898
  • 3
  • 32
  • 44
0

Here is a JSfiddle of a window scrolling to a div ID based on the URL. It could be modified to fire on a click event, or on a page load to read the URL for the ID being passed. Let me know if the example needs some adjusting.

This uses jQuery

http://jsfiddle.net/jmKUw/1/

Aaron Miler
  • 869
  • 11
  • 22
0

You'll need to pass the name of the div to scroll to, perhaps as a query string, to the contact page, and store it in a hidden input.

Then in a $(document).ready(function () {}); block, call your scrollto function, passing it the value of the hidden input.

KennyZ
  • 907
  • 5
  • 11