Active
Project:
Accordion Blocks
Version:
7.x-3.2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
5 Feb 2010 at 14:17 UTC
Updated:
23 Dec 2014 at 10:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
pflame commentedOh you want to enable the currently active menu block automatically?
You can do this by specifying activate index for accordion blocks widget. The following code might help you.
The above code will activate the 3rd block in both left side and right side. Need to find the index of the block which is showing the active menu.
Comment #2
hgltao commentedThank you for your reply. But I am just a new juy on Jquery. I don't know how can I get the index of the block I clicked.
Should I add this code to accordion_init.js in accordion blocks modules or some other places?
Can you give me more tipps?
Best Regars!
Comment #3
hgltao commentedAnother problem is that I used the code you wrote, but it still didn't work. Because my whole page would be reloaded after I clicked a link. Then the navigation will be rebuilt. The previous status of the navigation would be lost. How can I solve the problem? Should I only use jquery cookie?
Comment #4
2noame commentedThank you! This is exactly what I was looking for.
Comment #5
linneawilliams commentedHello, I'm having a similar issue.
I'm using accordion blocks on 5 small menus stacked in the same column (photo attached--the titles are block titles). When I click a link in the menu, the page reloads and the first block (chunk of the menu) opens again, even if the link was in subsequent block.
Does the above code only allow you to specify one block as always being open, or can it recognize what page it's currently on?
Help would be much appreciated!
-Linnea
Comment #6
pflame commentedHi linneaann,
The above mentioned code just activates the 3rd block. Accordion blocks module don't know any thing about current menu system. You have to check the current menu and activate the respective block using below code.
$('.accordion_blocks_container').accordion( "activate" , index);The index is the index of block, it starts with zero.
Comment #7
zoraxHello pfame,
I need to use this function too,
You said "You have to check the current menu and activate the respective block using below code."
where is the link between php and java?
Is it possible on a tpl.php file to launch a js function, if yes how to do that?
the function will be :
drupal.behaviors.accordion_blocks = function(){
$('.accordion_blocks_container').accordion('activate', $number);
}
$number will depend of the page visited.
Regards,
Comment #8
pflame commentedYou can launch js function in the tpl file by just writing script tag like this. But this is not the suggested way, but will work.
Comment #9
zoraxI try to place you code in page.tpl.php, in block.tpl.php in your module, but it doesn't worked..
Can you explain what is the suggested way to say to drupal :
on this page : accordion('activate', 2);
on this page : accordion('activate', 3);
Best Regards,
Comment #10
zoraxPlease can you tell us how we can choose to let opened the menu depending of the content type
for example :
content type 1 :
$('.accordion_blocks_container').accordion('activate', 3);
content type 2 :
$('.accordion_blocks_container').accordion('activate', 2);
the function is under the file : accordion_init.js
Where do we need to put the code (page.tpl, node.tpl??), we talked about a function, I imagine we need to launch this function but where and how ?
can you just give an example,
Best Regards,
Comment #11
dargente commentedwhere do we put this code?
like to have each main category page with a different accordion open.
Thanks!
Comment #12
pflame commentedI think, it is better to have this as an option for every accordion block. I will work on this in this week and post the updates.
Comment #13
Salbalea commentedI´m still searching for a solution for this issue.
Do you have some news?
As zorax wrote, an example like this would be great:
content type 1 :
$('.accordion_blocks_container').accordion('activate', 3);
content type 2 :
$('.accordion_blocks_container').accordion('activate', 2);