I'm working on horizontal scrolling website
Website (blueprint) working very well, animation work smooth and everythings fine.
But when I want to add window.location.hash
with ba-hashchange
plugin in this case does not work.
$(document).ready(function(){
$("nav").delegate("a", "click", function(event) {
window.location.hash = $(this).attr("href");
return false;
});
var newHash = "";
$(window).bind('hashchange', function(){
newHash = window.location.hash;
if (newHash) {
$('body,html').stop().animate({
scrollLeft: $(newHash).offset().left
}, 2500,'easeInOutExpo');
};
});
$(window).trigger('hashchange');
});
Here's live example without hashChange WITHOUT HASH EXAMPLE
And here's with hashChange WITH HASH EXAMPLE
Basicly what i want to do:
What's happening with hash:
Please help me to combine animation offset with hashchange. Thank you!!
Change id to data-id and navigate to not strick id
var adres = location.hash.substring(1);
if (newHash) {
$('html, body').stop().animate({
scrollTop: $("div[data-id='" + adres + "']").offset().top,
scrollLeft: $("div[data-id='" + adres + "']").offset().left
}, 1500,'easeInOutExpo');
}
Good luck all :)