I'm trying to add the title of the node on the left of the header which would expand like it normally does and a link on the right of the header which would link to some other content when the link is clicked (+ TITLE | LINK ). Is there a way to do this with Views Accordion?

Comments

GuyRus’s picture

I'm after the same functionality. I've got the links in there (add all the fields you want in the header and exclude from display then rewrite the title output) but when clicked on the links don't do anything due to the header onClick overriding them.

Wondering if you came up with a solution for this?

michaelw_dc’s picture

One way to tackle this is to capture the click on the link with jQuery and set the window.location to the href of the link. I created a javascript file, "links_within_accordion_header.js" and added it in via my theme's .info file (it was just a one-page site, so it was fine having it on every page of the site).

jQuery(document).ready(function() {
jQuery(".ui-accordion a").click(function() {
window.location = jQuery(this).attr('href');
return false;
});
});

narkoff’s picture

Issue summary: View changes

#2 worked for me. Thanks. I used the JS Injector module to limit the jQuery to certain pages.

anil280988’s picture

Views Nested Accordion can be use for this purpose. I creates a new view style, Views Nested Accordion, which inherits the Views Accordion style.
https://www.drupal.org/project/views_nested_accordion

satutama’s picture

I tried #2 with JS injector, doesnt matter where i put it and how i put it, it just doesn't work.
And then i tried #4, and still it doesn't work.

I managed to make the link work by forcing the link in the rewrite results of the header field.

I'm using 2 fields as a header, and instead of: [field_1] [field_2]
I put [field_1][field_2]

urmila26’s picture

Hi

i have tried by using jquery , it is working good.
but without using jquery , should i add link for accordion header in drupal 7??