http://demo13.ocjoy.com/ On this site this problem is solved, but I can not understand anyway how!

There are two links

A1 and A2

How to do so if

  • for a2, just a1 had 1 backround,
  • at a2.active, a1 had a completely different backround

There is a menu of categories in the online Store

img

The script is responsible for the deployment of subcategories when you click

$(document).ready(function(){$('.sliEsq').click(function(){$(this).parent().children('.sliesQ').toggle('fast');return false;});}); 

The script is responsible for changing the image (+) to the image (-) when pressed, the image is assigned via the background in CSS

 $(document).ready(function(){ $('.sliEsq').on('click', function(){$( this ).toggleClass( "open" );});}); 

Actually reference code a1 and a2 respectively

 <a title="Развернуть" style=" margin-top:0px; margin-left:-14px; width:11px; height:11px; float:left;" href="javascript://" class="sliEsq"></a> <a style="margin-bottom: 10px;" href="<?php echo $child['href']; ?>"> <?php echo $child['name']; ?></a> 

Now the essence of the problem, when moving to a category, automatically expands the subcategories, which, as it were, become open. but the picture remains (+), respectively, if you press minimize, the picture becomes (-). \ Those for the active category with the expanded subcategories should have a picture (-), but no.

CMS OPENCART

When moving to a category, automatic subcategory disclosure is responsible

 .box-category > ul > li a.active + ul {display: block} 
  • The class "active" appears in the second link dynamically or, for example, when loading a page with a certain parameter? If the first, then for what event is the class added / removed? If closer to the second, then why is JS here? In addition, it would be nice to show what you have done yourself and what did not work out. - Deonis
  • The asset class appears when the page is loaded via this link. There are no blueprints, because I do not know where to start. - shtormby
  • @Pasha Sokolchik, are you somehow orienting to something when adding the class "active" to link number 2? So why not be guided by the same for reference number 1? if ... else ... or ternary operator - can it not be used here? - Deonis
  • I just do not really understand these matters. This is solved through CSS or through SID, preferably with an example, for which I was previously grateful. - shtormby
  • @ Pasha Sokolchik JAVU - high-level language Java - Java programming language Javascript - Javascript programming language java! = Javascript - zb '

0