Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So.. based on what you wanted..</p> <p>The ideal way to do it is to have two classes defining the images for expanded and collapsed states.. then, on click, you toggle them depending on the state..</p> <p>I modified your jsfiddle example to demonstrate this </p> <p><a href="http://jsfiddle.net/2kQXW/30/" rel="nofollow">http://jsfiddle.net/2kQXW/30/</a></p> <p>This is the css that defines what images are being used for the states : </p> <pre><code>.expand{ background: blue url('http://cdn1.iconfinder.com/data/icons/fugue/icon/toggle.png') no-repeat center left; } .collapse{ background: blue url('http://cdn4.iconfinder.com/data/icons/fugue/icon/chevron-expand.png') no-repeat center left; } </code></pre> <p>and then in jquery, when you click on the element, you remove the classes and add appropriate one like so: </p> <pre><code>$(this).removeClass(); if(flag) $(this).addClass('collapse'); else $(this).addClass('expand'); </code></pre> <p>In case you have other classes to that main div.. you can either add that along when you change class in jquery, or use <code>removeClass('expand')</code> with a parameter to remove whatever class you want to remove.</p> <p>Is this what you wanted?</p> <p><strong>Edit</strong></p> <p>Based on your image.. <a href="http://jsfiddle.net/2kQXW/33/" rel="nofollow">http://jsfiddle.net/2kQXW/33/</a></p> <p>If you don't want image in default state.. then.. don't specify it in the css class... look at the above example and see if you can figure out what's happening..</p> <p><strong>EDIT 2</strong></p> <p>If you want the class changes after the animation finishes, make a new function call inside <code>slideDown('slow', &lt;new function to call after animation is complete here&gt;)</code> and that should do it.</p> <p>here's the demonstratioin - <a href="http://jsfiddle.net/2kQXW/36/" rel="nofollow">http://jsfiddle.net/2kQXW/36/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload