Function runs succesfully once and then is stuck in its initial values. Is there a way to clear the values?
Hello
The following code scrolls the page for me just fine once any one of three links calling on the function are clicked
- function crw_travel(rw_X, rw_Y){
- var caller = this
- $(caller).click(function (event) {
- event.preventDefault()
- $("html:not(:animated),body:not(:animated)").animate({ scrollTop: rw_X, scrollLeft: rw_Y},2000);
- })
- }//END FUNCTION RW_TRAVEL
Here is the code calling on this function
- <a href="#" onclick="crw_travel(1132,1088)" class="rw_caller">Link One</a><br />
- <a href="#" onclick="crw_travel(1200,100)" class="rw_caller">Link Two</a><br />
- <a href="#" onclick="crw_travel(1,1)" class="rw_caller">Home</a><br />
The issue is that once I click any one of the links, then I click another link after the first one is executed it will no longer work. It will run the animation function but will always use the values/arguments passed via the link first clicked.
In other words: If I click "Link Two" the page scrolls to coordinates 1200/100
If I scroll the page back to its starting position of 0/0 then click "Link One", the page will animate but will not scroll to 1132/1088. It will animate once again to 1200/100 (the coordinates passed from LINK ONE.
Do I need to CLEAR some kind of cache?
Thanks!
FA