Expand and collapse using Images


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function toggleMessages(id)
  2. {
  3. $("#msg_wrapper_"+id).slideToggle('slow');
  4. var src = ($("#arrow_"+id).attr("src") === "images/default/community/arrow_red_down.png")? "images/default/community/arrow_red_up.png" : "images/default/community/arrow_red_down.png";
  5. $("#arrow_"+id).attr("src", src);
  6.  
  7. var title = ($("#arrow_"+id).attr("title") === "Expand")? "Collapse" : "Expand";
  8. $("#arrow_"+id).attr("title", title);
  9.  
  10. //$("#arrow_"+id).attr("src","images/default/community/arrow_red_up.png");
  11.  
  12. }(

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.