![]() |
setTimeOut method
Hi,
Relatively new to javaScript. I tried to put a timer on the on the code below so the mouseenter event handler doesn't fire for a couple of seconds. I understand the abstract of the setTimeout method, but I cannot figure out how to incorporate it into this code. And I screw it up every time I try. I am trying to animate (increase) the height of the pageFooterContent div on mouseenter, and decrease it on mouseleave. Here is the page on which I would like to do this http://galileedetroit.org/index2.php. Pertinent code is below. Any help would be greatly appreciated. HTML Code:
<!-- BEGIN PAGE FOOTER -->Code:
#pageFooter {Code:
<script> |
Quote:
Code:
#pageFooter #pageFooterContent { |
I appreciate the reply.
In general, though, what do I gain or lose by doing things like this with CSS vs. JavaScript? Is this a CSS3 thing? If so (and browser prefixes notwithstanding), need I be concerned with any lack of support for this approach? Thanks, again!!! |
behavior in IE is far different than in Firefox. Seems to me that JS may be the best way to go because of the easing, among other things. what do you think?
|
You can use jQuery’s
delay() function. And also, it might be desirable to stop() the animation on runtime if necessary. |
Hey! I appreciate the suggestion. I did use the delay() method before. That was one of my first ideas. But the problem is that the function "remembers" the mouseenter event no matter how quickly it happens. If I pass my mouse over the pageFooter div, the function just fires after 2000 ms, no matter where I may be on the page thereafter. The nightmare was when I was debugging and quickly passed my mouse back and forth over the pageFooter div like 8 times and then scrolled to the top of the page. The pageFooterContent was bouncing up and down as many times because the function was doing what I told it to do.
But I found the answer below: Code:
var mnuTimeout = null;Thanks everybody! |
| All times are GMT +1. The time now is 10:28 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.