Thursday, 15 August 2013

Div fades out before toggle() is called

Div fades out before toggle() is called

I'm trying to create a custom toggle. Here is the code that predefines the
toggle:
$('.information').toggle(function() {
$('.work-overlay').fadeOut();
$('.information-overlay').fadeIn();
$('body').css({'overflow':'visible'});
e.preventDefault();
}, function() {
$('.work-overlay').fadeOut();
$('.information-overlay').fadeOut();
$('body').css({'overflow':'hidden'});
e.preventDefault();
});
And here is the code being called:
$(".information").click(function() {
$(".information").toggle();
})
However, before anything is clicked, the .information div fades out.
Would anyone know why?

No comments:

Post a Comment