943,852 Members | Top Members by Rank

Ad:
Apr 4th, 2008
0

Need help in javascript and modal window

Expand Post »
hi friends,

I need your help............. I have a div content in my home page.while clicking on that div i need a modal window... i have done that using jquery. In that modal window i need to call accordion java script for sliding menu.... and again i need to use a tab menu with fading effect.. i need all these in the same modal window..... Does any one know how to incorporate all these things in to one page..............

Please help me
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
sree22_happy is offline Offline
39 posts
since Mar 2006
Apr 4th, 2008
0

Re: Need help in javascript and modal window

Well the only thing you need for a modal window is two divs, and outer div to make the page modal and an inner div to hold the modal content. For example
html Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <title>Blah</title>
  4. <style type='text/css'>
  5. .modal
  6. {
  7. z-index:998;
  8. height:100%;width:100%;
  9. position:absolute;
  10. left:0px;top:0px;
  11. }
  12. .modalContent{ z-index:999; }
  13. </style>
  14. </head>
  15. <body>
  16. <div id='hello'>
  17. <a href='#'>You can't click on me!</a>
  18.  
  19. <div id='modal' class='modal'>
  20. <div id='modalContent' class='modalContent'>
  21. <a href='#'>You can click on me though!</a>
  22. </div> <!-- end modal content div -->
  23. </div> <!-- end modal div -->
  24. </div><!-- end hello div -->
  25. </body>
  26. </html>

With that said, if you know how to do all those effects in a modeless div then you know how to do them in a modal div. Just place the content inside the inner modal div (modalContent)
Last edited by ShawnCplus; Apr 4th, 2008 at 7:28 pm.
Sponsor
Reputation Points: 520
Solved Threads: 268
Code Monkey
ShawnCplus is offline Offline
1,564 posts
since Apr 2005
Apr 7th, 2008
0

Re: Need help in javascript and modal window

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <script type="text/javascript" src="modal.js"></script>
  4. <script type="text/javascript" src="jquery-1.2.2.pack.js"></script>
  5. <script type="text/javascript" src="ddaccordion.js"></script>
  6. <script type="text/javascript">
  7. ddaccordion.init({
  8. headerclass: "expandable", //Shared CSS class name of headers group that are expandable
  9. contentclass: "categoryitems", //Shared CSS class name of contents group
  10. collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
  11. defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
  12. animatedefault: false, //Should contents open by default be animated into view?
  13. persiststate: true, //persist state of opened contents within browser session?
  14. toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
  15. togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively ["position", "html1", "html2"] (see docs)
  16. animatespeed: "normal", //speed of animation: "fast", "normal", or "slow"
  17. oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
  18. //do nothing
  19. },
  20. onopenclose:function(header, index, state, isclicked){ //custom code to run whenever a header is opened or closed
  21. //do nothing
  22. }
  23. })
  24.  
  25. </script>
  26. <style type="text/css">
  27.  
  28. .arrowlistmenu{
  29. width: 180px; /*width of accordion menu*/
  30. }
  31.  
  32. .arrowlistmenu .menuheader{ /*CSS class for menu headers in general (expanding or not!)*/
  33. font: bold 14px Arial;
  34. color: white;
  35. background: black url(titlebar.png) repeat-x center left;
  36. margin-bottom: 10px; /*bottom spacing between header and rest of content*/
  37. text-transform: uppercase;
  38. padding: 4px 0 4px 10px; /*header text is indented 10px*/
  39. cursor: hand;
  40. cursor: pointer;
  41. }
  42.  
  43. .arrowlistmenu .openheader{ /*CSS class to apply to expandable header when it's expanded*/
  44. background-image: url(titlebar-active.png);
  45. }
  46.  
  47. .arrowlistmenu ul{ /*CSS for UL of each sub menu*/
  48. list-style-type: none;
  49. margin: 0;
  50. padding: 0;
  51. margin-bottom: 8px; /*bottom spacing between each UL and rest of content*/
  52. }
  53.  
  54. .arrowlistmenu ul li{
  55. padding-bottom: 2px; /*bottom spacing between menu items*/
  56. }
  57.  
  58. .arrowlistmenu ul li a{
  59. color: #A70303;
  60. background: url(arrowbullet.png) no-repeat center left; /*custom bullet list image*/
  61. display: block;
  62. padding: 2px 0;
  63. padding-left: 19px; /*link text is indented 19px*/
  64. text-decoration: none;
  65. font-weight: bold;
  66. border-bottom: 1px solid #dadada;
  67. font-size: 90%;
  68. }
  69.  
  70. .arrowlistmenu ul li a:visited{
  71. color: #A70303;
  72. }
  73.  
  74. .arrowlistmenu ul li a:hover{ /*hover state CSS*/
  75. color: #A70303;
  76. background-color: #F3F3F3;
  77. }
  78.  
  79. </style>
  80. <link rel="stylesheet" href="modal.css" type="text/css" />
  81. <script language="javascript">
  82. function showModal()
  83. {
  84. var x = 'something to check';
  85. $('txt').innerHTML = x;
  86. sm('box',300,300);
  87. }
  88.  
  89. function okSelected()
  90. {
  91. var y = x;
  92. alert(y);
  93. }
  94. </script>
  95. </head>
  96. <body>
  97. <div id="box" class="dialog">
  98. <div style="text-align:center">
  99. <span id="txt">Press OK to continue.</span><br>
  100. <button onclick="hm('box');okSelected()">OK</button>
  101. </div>
  102. <div class="arrowlistmenu">
  103.  
  104. <h3 class="menuheader expandable">CSS Library</h3>
  105. <ul class="categoryitems">
  106. <li><a href="http://www.dynamicdrive.com/style/csslibrary/category/C1/">Horizontal CSS Menus</a></li>
  107. <li><a href="http://www.dynamicdrive.com/style/csslibrary/category/C2/">Vertical CSS Menus</a></li>
  108. <li><a href="http://www.dynamicdrive.com/style/csslibrary/category/C4/">Image CSS</a></li>
  109. <li><a href="http://www.dynamicdrive.com/style/csslibrary/category/C6/">Form CSS</a></li>
  110. <li><a href="http://www.dynamicdrive.com/style/csslibrary/category/C5/">DIVs and containers</a></li>
  111. <li><a href="http://www.dynamicdrive.com/style/csslibrary/category/C7/">Links & Buttons</a></li>
  112. <li><a href="http://www.dynamicdrive.com/style/csslibrary/category/C8/">Other</a></li>
  113. <li><a href="http://www.dynamicdrive.com/style/csslibrary/all/">Browse All</a></li>
  114. </ul>
  115. <div>
  116. Regular contents here. Header does not expand or contact.
  117. </div>
  118.  
  119. </div>
  120. </div>
  121. <input type="text" size=250/><br/>
  122. <input type="button" onClick="showModal()" value="CLICK ME"></input>
  123. </body>
  124. </html>
Reputation Points: 10
Solved Threads: 1
Light Poster
sree22_happy is offline Offline
39 posts
since Mar 2006
Apr 7th, 2008
0

Re: Need help in javascript and modal window

In this code i am getting the modal window .. but when i put this accordion menu script its not working the modal window page.....I want a modal window in which i can put tab contents or sliding menus like accordion menu
Please help me
Reputation Points: 10
Solved Threads: 1
Light Poster
sree22_happy is offline Offline
39 posts
since Mar 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: help!
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Problems with form submition





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC