Good evening! I already asked a question about "Hiding blocks using jquery" and got the right answer to it.
`Good evening! Baseline: a catalog of products, each product of which is displayed on the page below each other. The problem is as follows: It is necessary that the goods are displayed in the form of a list and some β+β tags (for example, βHousehold goods 1, [+]β), when clicked, a block with information about a specific product was opened. It is also necessary to have the function "hide all blocks" and "reveal all blocks."
I would be grateful if you tell in which direction to dig (jqueryui dug, but did not understand) or throw a link to an already implemented example.`
The answer was the following:
<script type="text/javascript"> $(document).ready(function () { $('.showinfo').click(function () { // ΠΏΡΠΈ ΠΊΠ»ΠΈΠΊΠ΅ Π½Π° .showinfo ΡΠΊΡΡΠ²Π°Π΅ΠΌ/ΡΠ°ΡΠΊΡΡΠ²Π°Π΅ΠΌ Π±Π»ΠΎΠΊ Ρ ΠΈΠ½ΡΠΎΠΉ $(this).parent().find('.productinfo').toggle(); $(this).text($(this).text() == 'ΠΏΠΎΠΊΠ°Π·Π°ΡΡ' ? 'ΡΠΊΡΡΡΡ' : 'ΠΏΠΎΠΊΠ°Π·Π°ΡΡ'); return false; }); $('#hide-all').click(function () { // ΠΏΡΠΈ ΠΊΠ»ΠΈΠΊΠ΅ Π½Π° #hide-all ΡΠΊΡΡΠ²Π°Π΅ΠΌ Π²ΡΠ΅ Π±Π»ΠΎΠΊΠΈ, ΠΌΠ΅Π½ΡΠ΅ΠΌ ΡΠ΅ΠΊΡΡΡ ΠΊΠ½ΠΎΠΏΠΎΠΊ $('.productinfo').hide('slow'); $('.showinfo').text('ΠΏΠΎΠΊΠ°Π·Π°ΡΡ'); return false; }); $('#show-all').click(function () { // ΠΏΡΠΈ ΠΊΠ»ΠΈΠΊΠ΅ Π½Π° #show-all ΡΠ°ΡΠΊΡΡΠ²Π°Π΅ΠΌ Π²ΡΠ΅ Π±Π»ΠΎΠΊΠΈ, ΠΌΠ΅Π½ΡΠ΅ΠΌ ΡΠ΅ΠΊΡΡΡ ΠΊΠ½ΠΎΠΏΠΎΠΊ $('.productinfo').show('slow'); $('.showinfo').text('ΡΠΊΡΡΡΡ'); return false; }); }); </script> <a href="#" id="hide-all">Π‘ΠΊΡΡΡΡ Π²ΡΠ΅</a> <a href="#" id="show-all">Π Π°ΡΠΊΡΡΡΡ Π²ΡΠ΅</a> <div id="product-15" class="product"> <!-- ΠΊΠΎΠ΄ --> <div class="productinfo" style="display: none;">ΡΠ΅ΠΊΡΡ Ρ ΠΎΠΏΠΈΡΠ°Π½ΠΈΠ΅ ΠΏΡΠΎΠ΄ΡΠΊΡΠ°</div> <a href="#" class="showinfo">ΠΏΠΎΠΊΠ°Π·Π°ΡΡ</a> </div>
Now the task is complicated. It is necessary that there were not two buttons "Hide All" and "Expand All", but one that would perform the same functions and change its name accordingly when clicked.