ugrás a tartalomhoz

Javascript+div=probléma

kalikim · 2010. Május. 5. (Sze), 10.56
Sziasztok!

Egy kis segítséget szeretnék kérni. Találtam egy kis legördülő jquery menüt, amit megpróbáltam kissé átalakítani. Szinte minden sikerült, de most elakadtam. Tehát az a gondom, hogy a "submenu" div-be be van állítva egy háttér, viszont az utolsó "submenu" div-jébe egy másik hátteret szeretnék betenni. Próbálkoztam azzal, hogy csináltam egy "submenu1" div-et amiben beállítottam a hátteret, de akkor nem működött a menü. Szerintetek van rá megoldás? A választ előre is köszönöm.
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">  
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">  
  3.   
  4. <head>  
  5.   
  6. <script type="text/javascript" src="jquery-1.4.2.min.js"></script>  
  7. <script type="text/javascript" src="ddaccordion.js"></script>  
  8.   
  9. <script type="text/javascript">  
  10.   
  11.   
  12. ddaccordion.init({  
  13.     headerclass: "silverheader", //Shared CSS class name of headers group  
  14.     contentclass: "submenu", //Shared CSS class name of contents group  
  15.     revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click""clickgo", or "mouseover"  
  16.     mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover  
  17.     collapseprev: true, //Collapse previous content (so only one open at any time)? true/false  
  18.     defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc] [] denotes no content  
  19.     onemustopen: true, //Specify whether at least one header should be open always (so never all headers closed)  
  20.     animatedefault: false, //Should contents open by default be animated into view?  
  21.     persiststate: true, //persist state of opened contents within browser session?  
  22.     toggleclass: ["""selected"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1""class2"]  
  23.     togglehtml: [""""""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position""html1""html2"] (see docs)  
  24.     animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast""normal", or "slow"  
  25.     oninit:function(headers, expandedindices){ //custom code to run when headers have initalized  
  26.         //do nothing  
  27.     },  
  28.     onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed  
  29.         //do nothing  
  30.     }  
  31. })  
  32.   
  33.   
  34. </script>  
  35.   
  36.   
  37. <style type="text/css">  
  38.   
  39. .applemenu{  
  40. margin5px 0;  
  41. padding0;  
  42. width450px/*width of menu*/  
  43. border1px solid #ffffff;  
  44. }  
  45.   
  46. .applemenu div.silverheader a{  
  47. backgroundurl(index_gardient_down.png) repeat center top;  
  48. fontbold 16px ArialHelveticasans-serif;  
  49. color#000000;  
  50. displayblock;  
  51. positionrelative/*To help in the anchoring of the ".statusicon" icon image*/  
  52. widthauto;  
  53. height30px;  
  54. line-height30px;  
  55. padding-left30px;  
  56. text-decorationnone;  
  57. -webkit-border-radius: 15px;  
  58. -moz-border-radius: 15px;  
  59. border-radius: 15px;  
  60. }  
  61.   
  62.   
  63. .applemenu div.silverheader a:visited,  
  64. .applemenu div.silverheader a:active{  
  65. color#000000;  
  66. }  
  67.   
  68.   
  69. .applemenu div.selected a,  
  70. .applemenu div.silverheader a:hover{  
  71. background-imageurl(index_gardient_up.png);  
  72. colorwhite;  
  73. }  
  74.   
  75. .applemenu div.submenu{ /*DIV that contains each sub menu*/  
  76. background-imageurl(index_gardient_bg.png);  
  77. padding15px 45px 15px 45px;  
  78. height130px/*Height that applies to all sub menu DIVs. A good idea when headers are toggled via "mouseover" instead of "click"*/  
  79. }  
  80.   
  81. .applemenu div.submenu_end{ /*DIV that contains each sub menu*/  
  82. background-imageurl(index_gardient_bg_end.png);  
  83. padding15px 45px 15px 45px;  
  84. height130px/*Height that applies to all sub menu DIVs. A good idea when headers are toggled via "mouseover" instead of "click"*/  
  85. }  
  86.   
  87. </style>  
  88.   
  89. </head>  
  90.   
  91. <body>  
  92.   
  93. <div class="applemenu">  
  94. <div class="silverheader"><a href="http://www.snowman.hu">Dynamic Drive</a></div>  
  95.     <div class="submenu">  
  96.     Some random content here<br />  
  97.     </div>  
  98. <div class="silverheader"><a href="http://www.snowman.hu" >CSS Examples</a></div>  
  99.     <div class="submenu">  
  100.     Some random content here<br />  
  101.     </div>  
  102. <div class="silverheader"><a href="http://www.snowman.hu">JavaScript Kit</a></div>  
  103.     <div class="submenu">  
  104.     Some random content here<br />  
  105.     </div>  
  106. <div class="silverheader"><a href="http://www.snowman.hu">CSS Drive</a></div>  
  107.     <div class="submenu">  
  108.     Some random content here<br />  
  109.     </div>  
  110. <div class="silverheader"><a href="http://www.snowman.hu">Coding Forums</a></div>  
  111.     <div class="submenu" style="background-image:url(index_gardient_bg_end.png)">  
  112.     Some random content here<br />  
  113.     </div>          
  114. </div>  
  115.   
  116. </body>  
  117. </html>  
A honlapom ITT tudjátok elérni.
 
1

Osztályok

Poetro · 2010. Május. 5. (Sze), 12.20
Add hozzá a submenu_end osztályt az utolsó elemedhez, és deklaráld hozzá a CSS-t. Például:
  1. <div class="submenu submenu_end">  
  2. Some random content here<br />  
  3. </div>  
  1. .applemenu div.submenu_end{ /*DIV that contains each sub menu*/  
  2.   background-imageurl(http://kepfeltoltes.hu/100505/bg_www.kepfeltoltes.hu_.png);  
  3. }  
2

Köszönöm!!!

kalikim · 2010. Május. 5. (Sze), 12.45
Nagyon köszönöm a gyors választ. Sikerült!!! :D
3

Ne haragudjatok, de lenne még egy kérdésem.

kalikim · 2010. Május. 10. (H), 14.17
Arról van szó, hogy ezt a kis menüt eddig egy üres lapon szerkesztettem. Ott működött minden rendesen. Viszont most, hogy beillesztettem egy már meglévő tartalombameglévő tartalomba, nem funkcionál tökéletesen a dolog. Szerintetek mi lehet a probléma?
4

Hiányzik a script

Poetro · 2010. Május. 10. (H), 14.45
Mivel nincs ott az inicializáló script ezért nem fog menni.
5

Inicializáló script?

kalikim · 2010. Május. 10. (H), 16.00
Ne haragudj Poetro, de sajnos nem tudom, hogy mi az az inicializáló script.
6

Poetro!!!

kalikim · 2010. Május. 12. (Sze), 15.06
Poetro, ha van egy kis időd, akkor válaszolj légyszíves! Előre is köszönöm.