Below is my AJAX code loading a DIV from an external HTML file into a target DIV onto another HTML page, can anyone suggest how to make the page with the content loaded have back/refresh/hotlinking capabilities keeping the DIV loaded in the page?
$(document).ready(function(){
$(document).on('click', '#about2', function() {
$("#content").load("content.html #about", function() {
$.getScript("slides.js", function() {
$(window).scrollTop(0);
});
});
});
$(document).on('click', '#process2', function() {
$("#content").load("content.html #process", function() {
$(window).scrollTop(0);
});
});
$(document).on('click', '#materials2', function() {
$("#content").load("content.html #materials", function() {
$(window).scrollTop(0);
});
});
$(document).on('click', '#radio2', function() {
$("#content2").load("content.html #radiofriendly", function() {
$(window).scrollTop(0);
});
});
});
Basically, i'd like:
http://crookedcartoon.co.uk/print.html#process
To link straight to the page with the #process DIV loaded, allowing for refresh, back, forward browser functions. Any suggestions? At the minute it just links to http://crookedcartoon.co.uk/print.html with the original DIV loaded.
Thanks in advance, having real trouble with JQuery.
EDIT**
$(document).ready(function(){
$(document).on('click', '#about2',function ParseURL() {
switch(location.hash.split("&")[0]) {
case '#about':
$("#content").load("content.html #about", function() {
$(window).scrollTop(0);
});
break;
$(document).on('click', '#process2',function ParseURL() {
switch(location.hash.split("&")[0]) {
case '#process':
$("#content").load("content.html #process", function() {
$(window).scrollTop(0);
});
break;
$(document).on('click', '#materials2',function ParseURL() {
switch(location.hash.split("&")[0]) {
case '#process':
$("#content").load("content.html #materials", function() {
$(window).scrollTop(0);
});
break;
$(document).on('click', '#pricing2',function ParseURL() {
switch(location.hash.split("&")[0]) {
case '#process':
$("#content").load("content.html #pricing", function() {
$(window).scrollTop(0);
});
break;
default:
}
}
$(window).bind("pageshow", function(event) {
if (event.originalEvent.persisted) {
ParseURL();
}
});
$(document).ready(function ($) {
ParseURL();
});