PDA

View Full Version : How to Select Tabs Dynamically with DD Menu II



dmm2020
11-15-2009, 08:40 AM
HI, I urgently need a way of accomplishing the following with DD Menu II (http://www.dynamicdrive.com/dynamicindex1/ddtabmenu2.htm):

1) I need to be able to set the selected tab based on the page that is opened which I get using the $_GET['loadpage'] parameter. There are times when I do not want any tab "selected" but the contents menu populated.

2) I need to be able to make the previous tab selected on mouseout of the entire tab area, meaning that mouseout is not kicked in unless the mouse hovers out of both the tabs and the contents menu.

3) Need to have the contents menu populated by default based on the page opened (I have text variables defined for each page), and when the mouseout event is kicked in as part of 2 above, the default menu text is repopulated in the contents area.

Help would be deeply appreciated.

ddadmin
11-16-2009, 07:22 AM
What does $_GET['loadpage'] return as far as the possible values? If it's a number that corresponds to the tab number you wish to be selected (ie 1=1st tab), then you'd simply use PHP to dynamically generate this line within the script:


var initialtab=[1, "sc1"]

Changing 1 and "sc1" to the tab and tab content ID you want selected, respectively. To output JavaScript dynamically using PHP, you'd write out the surrounding <script> tags, plus the body of the JavaScript that should be dynamic. In this case, something like:


echo '<script type="text/javascript">\n';
echo 'var initialtab=[' . $_GET['loadpage'] . ',sc"' . $_GET['loadpage'] . '"]\n';
echo '<\/script>';

The above should proceed the reminder of the Tab Content script, which is just static. Also, be sure to delete the original line:


var initialtab=[1, "sc1"]

inside the script, so it doesn't override the dynamically generated one above.

For 2), doesn't the menu already behave this way? In the default demo for example, if you move your mouse over the "CSS" tabs, it stays there and doesn't snap back to the currently selected tab onmouseout of the menu.

dmm2020
11-16-2009, 02:36 PM
$_GET('loadpage') returns the URL of the page that is being loaded. In turn, I use code to extract the name of the page itself, i.e., login.

What I am struck on, is I need the tabs to return to the original page as soon as the mouse is moved out of the entire tab wrapper, which includes the contents area below.

From my original post...only item 2 needs addressed at this point. I figured out 1 and 3 on my own. The mouseout feature is spotty as it's not working when I mouse out of the tabs wrapper div that I created.

dmm2020
03-31-2010, 04:49 AM
No answer???? I hate to drop this script after this long. There has to be a way.

dmm2020
04-04-2010, 09:55 PM
You know, I really like this script and this website, but too much of the script is too generic and difficult to customize. Would be nice if there was better support available to answer questions or at least point us in the right direction, even if we had to pay a little for the script instead of free. I can't see how this website can be making money on ads if people get disgusted with the script because it dont perform exactly as described.