Hi,
I’m using a template that has some javascript hide/show toggles which I’ve setup to show my categories like so:
<div class="toggle-trigger" id="toggle-trigger-{cat_id}"> title etc….. </div>
<div class="toggle-container" id="toggle-container-{cat_id}"> individual categories listed with links etc. </div>The javascript is working fine but I’d like to get the page to ‘click’ and open the relevant category.
I added the ID’s as seen above to help with this and I can see they are all working fine.
I’m scratching my head with the javascript though, and think it’s an issue with parsing, ie. where it should be…. I’ve tried a bunch of things and non seem to work… anyway here is my code:
{if {last_segment_category_parent_id} == cat_id }
[removed]
alert("Here we go!");
$('#toggle-container-{cat_id}').toggle('slow');
$('#toggle-container-{cat_id}').show();
$('#toggle-trigger-{cat_id}').toggle('slow');
$('#toggle-container-{cat_id}').toggleClass("active");
$('#toggle-trigger-{cat_id}').click();
$("#toggle-trigger-{cat_id}").trigger("click");
[removed]
script should have run!
{/if}All those different lines are an attempt to get the damn toggle open! The alert is opening fine but nothing happens to my containers no matter what I do….
I’m really not very experienced in javascript so don’t really know how to approach this properly.
Any help with this would be much appreciated.
Thanks in advance,
j00lz