You could also try using setTimeout() like so:

setTimeout(function()
{
  $('#slidebar').toggle();
}, 2000);

This will activate the #slidebar toggle after 2000 milliseconds even
is the user is trying to interact with the #slidebar which may not be
what you want. I'm not sure what the slide bar is being used for but
if you wanted a more robust closing solution then you may want to make
use of timers to detect when the user is not using, or interacting
with #slidebar.

The following bit of code will detect when the user's mouse is no
longer interacting with #slidebar and close it after 2000
milliseconds.

$('#slidebartrigger').click(function(){
    $('#slidebar').toggle().hover(function(){
        //mouseover
        clearTimeout(closetimer);
    }, function(){
        //mouseout
        closetimer = window.setTimeout(function(){
            $('#slidebar').hide();
        }, 2000);
    });
});

If the mouse cursor moves off of #slidebar then a timer is created
that will fire the $('#slidebar').hide() function after 2000
milliseconds. If the cursor moves back over the #slidebar (hovers)
then the timer is cleared and #slidebar will not close. This code
isn't tested so you might need to tweak it a bit. I am using something
similar on my project and it works great.

On Oct 3, 7:21 pm, "Glen Lipka" <[EMAIL PROTECTED]> wrote:
> There is a pause plugin.  Does that do the 
> trick?http://blog.mythin.net/projects/jquery.php
>
> Glen
>
> On 10/3/07, somnamblst <[EMAIL PROTECTED]> wrote:
>
>
>
> > I currently have this
>
> > $(document).ready(function() {
> >         initSlideboxes();
> >         function initSlideboxes()
> > {
> > $('#slidebar').show();
> >         $('#slidebar').html($('#hidebar').html());
> >         $('#slidebartrigger').click(function(){$('#slidebar').toggle();
> > });
>
> > };
> > });
>
> > I would like after a certain duration of several seconds to have the
> > slidebar div hide. I know how to do this in scriptaculous but I have
> > abandoned my scriptaculous solution for jquery.

Reply via email to