PDA

View Full Version : Slide open menu onload - Slashdot's Menu



Timi
04-11-2007, 09:20 AM
1) Script name: Slashdot's Menu
2) Script URL: http://www.dynamicdrive.com/dynamicindex1/slashdot.htm

I think the slashdot menu is quite cool, and I am intending to use it on my website if i can get it to do what I actually want. Can someone figure out a way to make the menu slide open (from closed) on page load.....and (you guess it!) return to closed stage when page is not being viewed. I know this may look impossible but I might get lucky is what I think !!

techno_race
04-11-2007, 11:58 PM
I don't think that sounds possible. The problem arises with:

return to closed stage when page is not being viewed

mburt
04-12-2007, 12:25 AM
The reason it stays open is because of cookies.
Set the variable:

myMenu.remember = true;
to false.
It shouldn't store the cookies now, thus making it close on page exit.

Timi
04-12-2007, 11:15 AM
Thanks.......how do I get it to slide open on page load ?

tech_support
04-13-2007, 04:03 AM
Add this:
myMenu.expandAll(); to your code.

You need to replace myMenu with your one.

alejandro52
08-13-2007, 09:00 AM
Hello and thanks alot for this cool menu. I have a problem with the menu when i try to add an image map(created with fireworks) to my web page with the dsmenu loaded.The image map is working correcly but the dsmenu won't.All the css of the menu is correct, the only thing is that the menu won't collapse or open.It stays static.Here is the code from the image map.
Javascript
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
code from the body
<body onload="MM_preloadImages('../map/images/agathonisi.gif','../map/images/slice_r3_c9.gif','../map/images/slice_r3_c15.gif','../map/images/agathonisi_f4.gif','../map/images/slice_r3_c9_f6.gif','../map/images/slice_r3_c15_f4.gif','../map/images/loipsoi.gif','../map/images/slice_r4_c9.gif','../map/images/loipsoi_f4.gif','../map/images/slice_r3_c9_f4.gif','../map/images/slice_r4_c9_f4.gif','../map/images/patmos.gif','../map/images/patmos_f4.gif','../
map/images/leros.gif','../map/images/slice_r9_c7.gif','../
map/images/kalumnos.gif','../map/images/leros_f4.gif','../map/images/
slice_r9_c7_f4.gif','../map/images/kalumnos_f6.gif','../map/images/
slice_r9_c16.gif','../map/images/slice_r10_c8.gif','../map/images/
slice_r11_c8.gif','../map/images/kos.gif','../map/images/slice_r11_c18.gif','../
map/images/kalumnos_f4.gif','../map/images/slice_r9_c16_f4.gif','../
map/images/slice_r10_c8_f4.gif','../map/images/slice_r11_c8_f4.gif','../
map/images/kos_f6.gif','../map/images/slice_r11_c18_f4.gif','../map/images/
slice_r12_c10.gif','../map/images/kos_f4.gif','../map/images/
slice_r12_c10_f4.gif','../map/images/astupalaia.gif','../map/images/
astupalaia_f4.gif','../map/images/sumh.gif','../map/images/sumh_f4.gif','../
map/images/nisuros.gif','../map/images/nisuros_f4.gif','../map/images/
tulos.gif','../map/images/tulos_f4.gif','../map/images/rodos.gif','../map/
images/slice_r23_c22.gif','../map/images/slice_r23_c25.gif','../map/images/
rodos_f4.gif','../map/images/slice_r23_c22_f6.gif','../map/images/
slice_r23_c25_f4.gif','../map/images/xalki.gif','../map/images/xalki_f4.gif','../
map/images/karpathos.gif','../map/images/slice_r24_c22.gif','../map/images/
slice_r25_c12.gif','../map/images/Kastelorizo.gif','../map/images/
slice_r27_c21.gif','../map/images/karpathos_f4.gif','../map/images/
slice_r23_c22_f4.gif','../map/images/slice_r24_c22_f4.gif','../map/images/
slice_r25_c12_f4.gif','../map/images/Kastelorizo_f6.gif','../map/images/
slice_r27_c21_f4.gif','../map/images/slice_r25_c25.gif','../map/images/
Kastelorizo_f4.gif','../map/images/slice_r25_c25_f4.gif','../map/images/
kasos.gif','../map/images/kasos_f4.gif')">

alejandro52
08-13-2007, 05:30 PM
someone please?

alejandro52
08-13-2007, 05:34 PM
I was also wondering if it is possible to remove the arrow if the is no item in subcatecory.

jazzking2001
08-16-2007, 12:43 PM
I was also wondering if it is possible to remove the arrow if the is no item in subcatecory.

ya same here

also can weget it to have sub sections
this navi bar has unlimited subsections in it
http://www.dynamicdrive.com/dynamicindex1/blmmenu/index.htm
i really move this navi bar
i only reason i dont like it, is cuz u cant have sub sections
plz add subsections

mxwebsites
09-04-2007, 02:19 PM
I can't seem to get the menu to slide down when you click them... can anyone help?

www.wendricksrealestate.com

Thanks

Ictinus
09-20-2007, 01:30 PM
I was also wondering if it is possible to remove the arrow if the is no item in subcatecory.

I'd be interested in your feedback on the following entry:
http://www.dynamicdrive.com/forums/showthread.php?p=109119#post109119

Ictinus
09-20-2007, 01:37 PM
I can't seem to get the menu to slide down when you click them... can anyone help?

www.wendricksrealestate.com

Thanks

You have the onload event being defined twice. First by the sdmenu, then in the body tag itself for MM_preloadImages.

One way to fix this is to have a single function assigned to onload that calls both the sdmenu init and MM_preloadImages functions.

cojijo
10-26-2007, 12:55 PM
Hi,
I m having a problem, the original menu is like that:

Online Tools
bla bla
bla bla
Support Us
bla bla
bla bla
Partners
bla bla
bla bla
Test Current
bla bla
bla bla

I was adapting the menu to my testing web page and I found that when I delete one element from de menu (in this example TEST CURRENT), trying to get:


Online Tools
bla bla
bla bla
Support Us
bla bla
bla bla
Partners
bla bla
bla bla
it alerts me with a pop-up saying
"There was an error in execution time.
Line: 31
Error: 'this.submenu[...]' is null or is not an object"

if I add 4 or more elements it works very well, but if I delete one element that is the error.
How can I solve it?
Sorry, my english is very very bad, see you

Ictinus
10-26-2007, 01:16 PM
cojijo,
make sure you have removed all the submenu elements.
The complete set of tags for that last menu are


<div>
<span>Test Current</span>
<a href="?foo=bar">Current or not</a>
<a href="./">Current or not</a>
<a href="index.html">Current or not</a>
<a href="index.html?query">Current or not</a>
</div>

As a test I removed just the <span> and received a similar error.

cojijo
10-31-2007, 07:08 PM
I want to set my own number of states and menu
How it know the quantity of menu, elements of menu and state??

Im having problem with that lines

var regex = new RegExp("sdmenu_" + encodeURIComponent(this.menu.id) + "=([01]+)");
var match = regex.exec(document.cookie);

because the value of document.cookie is "sdmenu_my_menu=0000000; ASP.NET_SessionId=gycyxryusiua0qf2o0iavu45"

and I want to set other quantity of states

the error is in the line

this.submenus[i].className = (states[i] == 0 ? "collapsed" : "");

when i = 4

Please help me.

djiwa
11-05-2007, 09:35 AM
Big Hello to everybody! And congratulations to the author on this great script.

I have a slight problem. Script works fine, but when I decide to run another link that is not a part of this script, menu won't contract on default position (collapse all), and stays open. If anyone could answer me how to work this out, please? ..tnx..

tech_support
11-05-2007, 09:38 AM
Please create a new thread for each question.

//Closes thread.