Hash Change

Hi, I would like to get some help regarding a hash change. The PHP code I have within my page located here, will not load the HTML location within the ID and I have been informed that this script I assume must be added ?

By hash do you mean the stuff after the ‘#’ in a URL?

If so, this cannot be changed in PHP because it is never actually sent to the server.

The OP’s page uses jQuery to show and hide divs when menu items are clicked and also specifiying which div is revealed on page load. The problem is that he wishes to use a PHP contact form script that will return to a specific div when submitted.

Also, as the page is practically a site in a single document, it would be useful for the Back and Forward buttons to work and for specific divs to load directly by URL when their fragment identifier is appended.

In the hope of fixing all these issues I directed the OP, in the PHP forum, to investigate the jQuery hashchange event plugin - to which he seems to have forgotten to include a link.

Sorry, I did forgot the hashchange event plugin :slight_smile: Victor explained the situation :slight_smile:

You could look at YUI’s history manager. You can catch events when divs are opened and closed then use the browsers back/forward buttons the step throw the changes in the sequence they were done (without refreshing the page I believe).

YUI history manager will cause the HTML page, instead of loading on it’s own but rather load within the ID on the same page, If I understood correctly ?

Why does the browsers back & forward button have to be used ? I don’t want the end user have this functionality at their finger tips, not understanding!

Why wouldn’t you want the Back and Forward buttons to work? It’s basic usability. Although your page is hiding and revealing content with scripting, to the user it will seem to be a conventional website where clicking the main menu loads a new page.

Let’s say you want to show someone your 3D stuff. Is it more convenient and professional to give them a direct URL to that or to have to tell them to go to the site and click on a link in a dropdown menu?

Back/Forward, direct URLs and the redirection behaviour that you want for your form are all related and I doubt that you can have one without the other.

Have you tried implementing jQuery hashchange event yet?

Why wouldn’t you want the Back and Forward buttons to work? It’s basic usability. Although your page is hiding and revealing content with scripting, to the user it will seem to be a conventional website where clicking the main menu loads a new page.

Let’s say you want to show someone your 3D stuff. Is it more convenient and professional to give them a direct URL to that or to have to tell them to go to the site and click on a link in a dropdown menu?

Back/Forward, direct URLs and the redirection behaviour that you want for your form are all related and I doubt that you can have one without the other.

Good Point, I assume jQuery Hash change adds this functionality ?

Have you tried implementing jQuery hashchange event yet?

I will be, then I’ll update :slight_smile:

Hi, I’ve got the scripted installed on the page although that is all I’ve done as I wasn’t clear to me, how this script gets setup. You can view the page with the script within here.

Invalid URL.

Should be: http://www.thecreativesheep.ca/construction/construction_site_G.htm

The script is not at the specified location.

Hope someone else will be able to pick this up as I’m otherwise engaged for a few days.

A stupid me. Posting the URL, sorry. What do you mean it’s not at a specific location?

http://www.thecreativesheep.ca/construction/jquery.ba-hashchange.min

“.js” is missing.

Complete.

Victor. I’m assuming it’s not simple as just installing the script in the page and it should work?

The script is still not active in your page because you have misspelt “src”.

<script scr="http://www.thecreativesheep.ca/construction/jquery.ba-hashchange.min.js" type="text/javascript"></script>

See the developer’s page for instructions. As I said above, I’m busy and can’t offer help in depth with this.

Tip: Firebug has at least two ways of showing whether a script is active.

  1. In the HTML tab, find the script in the head and click on the grey triangle to the left. If the script is present its code will be revealed below.
  2. In the Script tab, there is menu (currently showing “construction_site_G.htm”) that lists all the acive script when clicked.

Ooops about the spelling mistake, when you do stuff at 1am as I like to do :frowning: The script is active. Although you don’t have the time to help me make this function as it should, in the meantime I’ll read over the documentation and try to decipher what is being said. I only studied a little javascript thus far !

If this is still your page then “src” is still “scr” and the script still not active. Perhaps you’ve forgotten to upload the amended page.

That page is updated, I didn’t do a rename :slight_smile:

Victor, checked out the hasChange script documentation. Their isn’t much that I would personally understand, besides the author posting the source code and the source code can be changed to suit whatever needs. I have updated the page with the correct link to the script, fatigue played a part in my previous messages :slight_smile: