There is the following file structure, I want to do the following - when clicking on main, it is checked if show-title (has the display:block property), then do nothing, if when clicking on main hide-title (has the display:block property), then make an animation before the section about-header. I do not know how to write such checks: (

 <div class=main> <h4 class="show-title">Показать полностью<h4> <h4 class="hide-title>Свернуть<h4> <div> $(".hide-title").click(function() { $("html, body").animate({ scrollTop : $(".about-header").offset().top }, 400); }); 

    2 answers 2

     var isVisible = $('.show-title').is(":visible"); 

    • Please give a more detailed answer to how this code solves the problem voiced in the question. - eugeneek
    • @eugeneek below comrade figured out the same method) - tcpack4

    Understood)) it seems everything works.

     $(".main").click(function() { if ($(".show-title").is(":visible")) { } else { $("html, body").animate({ scrollTop : $(".about-header").offset().top }, 400); }; });