Answer the question
In order to leave comments, you need to log in
How to hide a block?
Hello. Tell me how to hide the block (block2), which is displayed on the entire page. But you need to hide it when showing another block (block1), which it overlaps. That is, I pressed the button block1 appeared, block2 disappeared.
Answer the question
In order to leave comments, you need to log in
Looking at how the block is "hidden"
$('button').on('click', function(){
if($('.block1').is(':visible')){
$('.block1').slideUp(300);
$('.block2').slideDown(300);
}
else{
$('.block1').slideDown(300);
$('.block2').slideUp(300);
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question