Reputation: 2255
I have a deeplink set up I've made for my site, and it works with exception of the forward and backwards buttons, and I'm a little unsure how to update what I've done. The url changes but the content doesn't unless you hit refresh.
here is an example of it working: http://www.klossal.com/index2.html#color_dance
and here is the code:
// taked anchor from browser i.e '#bow' , '#bow-003'
var id = window.location.hash;
// check is it valid anchor
if (id.match("#") != null | id.match("#undefined") != null) {
$(id).ready(function () {
$(id).trigger("click");
});
}
$(".iso").click(function () {
window.location.hash = $(this).attr("id");
});
Upvotes: 0
Views: 142
Reputation: 2255
$(window).on('hashchange',function() { var id = window.location.hash;
// check is it valid anchor
if (id.match("#") != null | id.match("#undefined") != null) {
$(id).ready(function () {
$(id).trigger("click");
});
}
});
Upvotes: 1