Question

I have a menu with several options. When I select one, I make a slideDown over a hidden div to show the content of it. So far so good, but when I click on another option, I don´t manage the slideUp of the same div to link to another one.

I put my function, with delay() I manage the slideUp but not the link, and without delay() the link works but does not slide...

irSobre function () {
        $ ('# scrollbar2'). slideUp ('slow');
        delay (). location.href = "sobre.html";
}

Greetings.

Was it helpful?

Solution

I don't think you can use delay with a non jquery function. Try:

$('# scrollbar2').slideUp ('slow');
setTimeout(function() { location.href = "sobre.html" }, 500);

Where 500 is the number of milliseconds to wait before redirecting.

OTHER TIPS

Try using the complete argument of slideUp to fire your link after the slideUp is finished:

$('# scrollbar2').slideUp ('slow', function() {
    location.href = "sobre.html";
});

More info here: http://api.jquery.com/slideUp/

Use slideUp's callback function.

$('#scrollbar2').slideUp('slow', function(){
    location.href = "sobre.html";
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top