Thank you for the reply!
Yeah, I guess the code would be usefull after all. I just can't post it right now since I'm not at work but I will do so the first thing I get there on Monday. I'm just gonna have to figure out how to shorten it to the relevant bits... whatever they are. ;-)
But interestingly enough, I thought of doing something like what you suggested, yesterday after I made the post. I'm just not sure if it was the same and if it works in Javascript (would work in any other language I know.)
I had:
Code:
<script>
function clicked(value,key,currentState) {
do_something();
}
function changeState(value,key,newState) {
do_something_else();
}
</script>
and I changed it to:
Code:
<script>
var goAhead = true;
function clicked(value,key,currentState) {
if (goAhead) {
goAhead = false;
do_something();
goAhead = true;
}
}
function changeState(value,key,newState) {
do_something_else();
}
</script>
with the links calling "clicked" and "clicked" containing multiple calls to changeState all within the if-Block.
Now to test if that actually prevented multiple simultaneous calls to the function I put a slow fade effect in when changing the links and: lo-and-behold: Multiple calls were still possible, the animation started over and over whenever I clicked the link.
So maybe I'm getting wrong how Javascript works? Doesn't a JS function wait for a called function to return before it continues its execution?
Erm.. maybe I should read up on basic JS.
Bookmarks