The bottom line is this: When you click on Button, content leaves, when you click on another Button, the first content disappears, and the second leaves - the way it works ... But you need more ... When you click on the same Button (2nd time) - the block should be hiding ... how to implement? :)
PS
I tried with the second button, which had display: none; - when pressed, they changed, but a very large block came out and jQuery
.
3-4 such blocks
$(document).ready(function() { $(button).one('click', function() { $('.news').slideUp('slow'); $(this).siblings(".news").slideToggle('slow'); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="bar"> <div class="text"> <p> <h1>Lorem ipsum</h1> </p> </div> <div class="news"> " Lorem ipsum dolor " </div> <div class="button "> <button type="button">Button</button> </div> </div> <div id="bar"> <div class="text"> <p> <h1>Lorem ipsum</h1> </p> </div> <div class="news"> " Lorem ipsum dolor " </div> <div class="button"> <button type="button">Button</button> </div> </div> $(document).ready( function(){ $('.button').click(function(){ var block=$('.news').css('display'); if(block=='none') { $('.news').slideUp('slow'); $(this).siblings('.news').slideToggle('slow'); } else{ $('.news').slideUp('slow'); } }); }); Anyway, it will bug ... if several such news - it sees only the upper keys button u news