SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Expand and Collapse effect

    hi folks,
    i was just getting started to learn about how to have expand and collapse effects, i work on css and html, but i saw collapse and expand effect on few website, so i wanted to learn it. i m just a starter in JavaScript and jQuery, so wanted some advice, where should i start? appreciate anyone who would contribute to my knowledge
    All those who wander aren't lost.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    These effects just involve using onclick events to trigger code that shows or hides other parts of the page.

    There can be some interesting complexities though, so as you mentioned jQuery, that has accordions and treeviews as good common starting points.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    so as i m starter in jQuery, how do u rate the accordions, as it is fit for what i was looking
    All those who wander aren't lost.

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    They're easy to code and manage. You know best whether accordions or tree vies are more suitable to what you're wanting to achieve. You have links in my previous post to demos about them, along with documentation too, so you can see them, use them, and determine which of the types are more suited for you.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    hey pmw57. as i told i am using the accordion jQuery link you told me. now i am in need of something else. by default one div is opened. i want all div closed on default. how can i modify that?
    All those who wander aren't lost.

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Will you also be allowing multiple panels open at the same time?

    An Accordion is where only 1 panel is open at any time. There are different solutions available depending on whether you'll also allow more than one panel to be open. Will you be restricting things to being only 0 or 1 panel open at any time, or will more be also allowed?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yes i understand Accordion (as i play music myself ) so its open panel opened at a time. i don't want multiple panel opened at same. what i need s when a person open my page. all of the Accordions are closed by default having said that just like a person click one panel to open it, clicking it again should close it. now i am just a starter in jQuery so i know nothing. i was wondering if you can help me modifying the needs i want. thanks
    All those who wander aren't lost.

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,705
    Mentioned
    102 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by emaarkhan View Post
    what i need s when a person open my page. all of the Accordions are closed by default
    The documentation for the jQuery accordion says that there is an "active" option that can be set to false, which displays none of them at the start.

    Here is an example of how it would be used:

    Code php:
    $( "#accordion" ).accordion({ active: false });
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •