accordion actions

accordion actions

I have this code:

  1. <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" /> 
  2. <script src="http://code.jquery.com/jquery-1.8.2.js"></script> 
  3. <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script> 
  4. <style> #accordion-resizer { padding: 10px; width: 350px; height: 500px; } </style>
  5. <script>
  6. $(function() {
  7. $("#accordion").accordion({
  8. heightStyle: "fill"
  9. });
  10. });
  11. $(function() {
  12. $("#accordion-resizer").resizable({
  13. minHeight: 140,
  14. minWidth: 200,
  15. resize: function() {
  16. $("#accordion").accordion("refresh");
  17. }
  18. });
  19. });
  20. </script> 
  21. <!-- Body Code -->
  22. <!-- HTML frag_1 -->
  23. <!--Preamble-->
  24. <div style="position:absolute;left:51px;top:66px;width:236px;height:170px; /*MainDivStyle*/" __addcode="here">
  25. <h3 class="docs">
  26. Drag bottom right corner to resize
  27. </h3>
  28. <div id="accordion-resizer" class="ui-widget-content">
  29. <div id="accordion">
  30. <h3>
  31. Section 1
  32. </h3>
  33. <div>
  34. <p>
  35. Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
  36. </p>
  37. </div>
  38. <h3>
  39. Section 2
  40. </h3>
  41. <div>
  42. <p>
  43. Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. 
  44. </p>
  45. </div>
  46. <h3>
  47. Section 3
  48. </h3>
  49. <div>
  50. <p>
  51. Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. 
  52. </p>
  53. <ul>
  54. <li>
  55. List item one
  56. </li>
  57. <li>
  58. List item two
  59. </li>
  60. <li>
  61. List item three
  62. </li>
  63. </ul>
  64. </div>
  65. <h3>
  66. Section 4
  67. </h3>
  68. <div>
  69. <p>
  70. Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. 
  71. </p>
  72. <p>
  73. Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. 
  74. </p>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. <!--Postamble-->


I want:
1.-to make that when you enter at first time on the page all tbas are closed because in this demo always begin with section 1 opened. I want to be closed section 1 when first time load the page and then you click on any section to open
2.-For example if you click section 2 you open section 2 but if you click again section 2 not close. I want to close the tab opened too if you click in the same tab section.
3.-Is there a way to change the colors of the title on the sections for example change "Section 1" background color and the background text and font when is opened the section change too. On the same way for other sections.
   If someone help me adding mods to the code I used  I don´t understand very well jquery and I very confused with all for now. The most important is point 1 and 2.


Thank you

[moderator reformatted]