I run into a little problem today. I’ve a divbox. This divbox should expand if I hover it and should collapse if I leave it.
so I write two functions:
- function expand(){….};
- function collapse(){….};
and then i tried to do the hover effect as following:
$('.divboxes').hover(expand(), collapse());
I thought this will work…but…not.
several times I used it like:
$('.divboxes').hover(function(){...},function(){...});
and it worked…so can someone explain me what I am doing wrong? I want the functions external!
Remove the parenthesis from the function names because this is attaching the output of the expand/collapse functions to the events.