I want to know if it is possible for the script to detect the URL binding and load the content specific to this anchor. For example, I have this line of code:
<a href="#home"><span id="homeMenu">Home</span></a>
This line of code listens for this code:
$("#homeMenu").click(function () {
$("#home_content").show("slow");
$("#accommodations_content").hide("slow");
});
How can I do this if the user visits http://www.myurl.com/home.html#homethat he automatically downloads home content. This should also work for all other anchors that I would like to implement.
I want this because, right now, if the user visits any of the anchors directly, there is no mater that is attached, it will always display the home page. So, is there a way to determine which URL is loaded, and then run the script on this?
EDIT
So, currently it is ONLY loading housing (even if at # home)
Current Code:
<script type="text/javascript">
$(document).ready(function() {
document.getElementById("javascriptCheck").style.visibility = 'hidden';
$("#menu").load("snippets/menu.html");
$("#locationMenu").load("snippets/locationMenu.html");
$("#home_content").load("snippets/home_content.html");
$("#accommodations_content").load("snippets/accommodations.html");
$("#history").load("snippets/history.html");
$("#footer").load("snippets/footer.html");
var hash = window.location.hash;
if (hash = "#Home") {
$("#home_content").show("slow");
$("#accommodations_content").hide("slow");
}
if (hash = "#Accommodations") {
$("#accommodations_content").show("slow");
$("#home_content").hide("slow");
}
} );
</script>