1

I am using views to to display title,image,date,description of a specific content type. By default the first element in the views has to be shown, where else the remaining![enter image description here][1] would be hidden . When the user clicks the 2nd title the 2nd node's content has to be shown and the rest has to be hidden. It would be great if some one can help me to achieve this.

0

This seems like a perfect job for Views Accordion.

| improve this answer | |
1

If you prefer to handcraft you can create a template (look inside your Views template suggestions) and paste inside this code. Then using functions like views_get_view_result() you can fetch views field and use them inside it.

<?php
    drupal_add_library('system', 'ui.accordion');
    drupal_add_js('jQuery(document).ready(function(){jQuery("#accordion").accordion();});', 'inline');
    ?>
    <div id="accordion">
    <h3><a href="#">Section 1</a></h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>

    <h3><a href="#">Section 2</a></h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>

    <h3><a href="#">Section 3</a></h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
    </div>
| improve this answer | |
  • The above module solved my problem. Thanks for your reply onirio:) – user4081 Apr 3 '12 at 7:26
0

The Views Accordion module has that functionality built right in.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy