[jQuery] clearTimeOut(this.iTimer) is not defined
Hi!
I'm currently taking my first steps again my own first plugin. As you
probably already figured out, it's not working.
It is a small plugin that is supposed to animate a menu or any other
element so that it stays visible to the user, even when the user
scrolls down the page. Before I can start to animate, I need to make
sure that the scrolling has stopped, and this is where the (first?)
problem occurs.
Before I call clearTimeOut() I check to see if it's undefined to
escape any errors, but the funny thing is that is still executes the
clearTimeOut().
Here's the function:
if ( this.iTimer != undefined || this.iTimer != 'undefined' ) {
try {
clearTimeOut(this.iTimer);
} catch (exception) {
alert(exception);
}
}
I have set up two different test pages for you to inspect, the first
one (http://www.kpsdiscjockey.se/jquery/jquery.test.html) is built
without the code as a plugin, the second one (http://
www.kpsdiscjockey.se/jquery/jquery.test2.html) is build with the code
inside a plugin.
So the ultimate question is: What do I do wrong?
Thank you!
Carl-Fredrik
PS. As this is my first plugin, I'm happy to receive comments and
suggestions for improvements on the code as a whole.