N
N
Nikita Salnikov2021-06-30 10:23:37
css
Nikita Salnikov, 2021-06-30 10:23:37

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

1 answer(s)
S
Sergey Miller, 2021-06-30
@blackseabreathe

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 question

Ask a Question

731 491 924 answers to any question