P
P
prevo2021-07-05 12:56:59
css
prevo, 2021-07-05 12:56:59

How to implement different sliding panels when clicking on an image?

When you click on the image, panels pop up on both sides. How to make different blocks when clicking on different pictures, example . I can only get it when I click on the first image, I'm not good at JS

60e2d70fdb847218883056.jpeg

60e2d71be6054636764642.jpeg

JS

$('.open-content').click(function() 
{
        if(!$('.portfolio__item').hasClass('open-box'))
        {
            $('.portfolio__item').addClass('open-box');
            $('.block-3').addClass('open-box');
            setTimeout(function(){$('.block-4').addClass('open-box')}, 100);
            setTimeout(function(){$('.portfolio-closebutton').addClass('open-box')}, 500);
            
        }
        else
        {
            $('.portfolio__item').removeClass('open-box');
            setTimeout(function(){$('.block-3').removeClass('open-box')}, 300);
            setTimeout(function(){$('.block-4').removeClass('open-box')}, 300);
            setTimeout(function(){$('.portfolio-closebutton').removeClass('open-box')}, 600);
        }
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question