Search code examples
ruby-on-railsrubyhtmlhyperlinkhref

href # within index.html#(number) problem


My site is built around a coda slider which shows different divs when they are selected from the navigation menu e.g home is www.mysite.com/index.html#1, about us is www.mysite.com/index.html#2, and so on.

Within the about us div (#2) I have a sliding form which has four divs that display one after the other. The tutorial I followed to set up the sliding form said to use links like <a href="#">Next div</a> to allow the user to switch divs. But the links don't work within my site because the user is already at index.html#2 when they see the form.

I'm sorry that this is so confusing but how can I get the links to work? I just need another way of specifying links to the divs so that my site doesn't get confused with the links.


Solution

  • The tutorial I followed to set up the sliding form said to use links like Next div to allow the user to switch divs.

    I think the tutorial means that you implement a JavaScript event on that to switch the link, it looks like this:

    <a href="#" onclick="switchDivs(); return false;">Switch next</a>
    

    the return false is to prevent the link from working, but to invoke the JavaScript only.