I'm coding a lock screen which takes "inspiration" from Windows 8. When the user clicks the image it slides up to reveal the password input field etc. I want the lock screen to "transition" or "animate" instead of just changing the display properties.
I've set up an event handler for the click which calls a function called SlideLockscreenUp. It's when I run this that I'm met with the "Maximum Call Size Stack Exceeded" error. Initially my code was:
function slideLockscreenUp(){
t = setTimeout(function(){
ls.style.top = '-1%';
}, 100);
slideLockscreenUp();
}
When I first got the error I assumed it was because I hadn't set any condition for the recursion to stop, hence it would continue for ever forcing the browser to interfere.
So this is what I came up with next:
function slideLockscreenUp(){
do{
t = setTimeout(function(){
ls.style.top = '-1%';
}, 10);
slideLockscreenUp();
} while(ls.style.top < "-100%" );
}
As you can see I test the display properties to stop the function when the position:top is -100%. However I'm still getting the error and now I'm slightly confused as to why. Any help would be great!
setTimeoutfunction will never get a chance to run as long as thewhileloop is running.