i use the libary easing to scroll to ankor, but my code doesnt work if i klick on a second ankor it jumps to top again and then dont work at all. here is my homepage im working on:
here is the jq i use:
$(function() {
//catch all the clicks on tags
$("a").click(function() {
//check if it has a #
if(this.hash){
//get rid of the # sign
var hash = this.hash.substr(1);
//get the position of the <a name>
var $toElement = $("a[name="+hash+"]");
var toPosition = $toElement.position().top;
//scroll/animate
$("body,html").animate({
scrollTop : toPosition
},2000,"easeOutExpo");
return false;
}
});
if(location.hash) {
var hash = location.hash;
window.scroll(0,0);
$("a[href="+hash+"]").click();
}
});
would be nice if someone could help me sincerely Oliver
Try putting something (text) or a non-breaking-space in your Name-tag
e.g.:
<a name="Simulight">SSS</a>
<a name="Simulight"> </a>