jquery - Sliding panel jumping back to home when clicked -
jquery - Sliding panel jumping back to home when clicked -
i made vertical sliding panel on 1page website (click psssst on top right). in works fine, slides , downwards (still little bump on button when sliding, no biggy).
the problem when scroll right , click sliding panel jumps origin of page.
how can fix/prevent this? can view problem here: http://www.basenharald.nl/3d
thanks in advance!
it seems have two problems:
the first problem (you've fixed it, think)the click event on anchor sending '/#' url. happens because anchor element has href of "#" , default behavior of browser send url.
in order prevent happening, should utilize e.preventdefault() in click event handlers, or return false if want stop event propagation (because that's how jquery works).
it seems after preventing default behavior, clicking on '#open' or '#close' still bringing scroller initial state. in firebug can see there handler click event on elements causing happen. can see running in firebug:
console.log($('#close')[0].onclick.tostring()) you'll see this:
function () { scroller.end(this); l = this.hash.substr(1); = document.getelementsbytagname("a"); (i = 0; < a.length; i++) { if (a[i].name == l) { clearinterval(scroller.interval); scroller.interval = setinterval("scroller.scroll(" + scroller.offsetparent(a[i]) + ")", 10); } } } it seems somewhere in code you're assigning event handler all anchors, , line
scroller.interval = setinterval("scroller.scroll(" + scroller.offsetparent(a[i]) + ")", 10); is what's causing scroller "reset", "go back" or something.
maybe problem conditional? maybe if (a[i].name == l) evaluating true , ends assigning event handler all anchors though that's not intent.
i don't know plenty app and/or whatever plugins you're using, can tell problem is, , it's in function.
hope helps.
jquery html css slidetoggle
Comments
Post a Comment