JavaScript.CoolDev.Com Support Forums
Any questions related to JavaScript menu and JavaScript tree menu by Javascript.CoolDev.Com
| Author |
Message |
LAMF
Joined: 25 Feb 2007 Posts: 3
|
Posted: Sun Feb 25, 2007 2:18 pm Post subject: On Mouse Over image problems |
|
|
I am doing my first COOLjsMenuPRO and I have almost accomplished my mission. I guess this is an easy one but...
Here we go:
I want all top level items to be a roll over image and on the first one it works but then on the second even all sub menus get the same image....?
I only want rollover images on the top level but on the sublevel I only want regular text with my own defines style (css)... What is wrong with my syntax here?
First image line is highlighted in blue and the second one (where it fails) in red....
here is the menu file with styles and contents code.
var color = {"border":"#000000", "bgON":"#BFFF00","bgOVER":"green"};
var color2 = {"border":"#000000", "bgON":"#FFFFFF","bgOVER":"#FF6600"};
var css = {"ON":"clsCMOn", "OVER":"clsCMOver"};
var STYLE = {"border":1, "shadow":0, "color":color, "css":css};
var STYLE1 = {"border":1, "borders":[1,1,1,0], "shadow":0, "color":color, "css":css};
var STYLE2 = {"border":1, "borders":[1,0,1,0], "shadow":0, "color":color, "css":css};
var STYLE3 = {"border":1, "borders":[1,0,1,1], "shadow":0, "color":color, "css":css};
function copy(o) {
var r = {};
for (var i in o) r[i] = typeof(o[i]) == 'object' ? copy(o[i]) : o[i];
return r;
}
BLANK_IMAGE = 'images/b.gif';
var MENU_ITEMS = [
{"pos":[0,0], "itemoff":[0,69], "leveloff":[19,0], "style":STYLE, "size":[20,70]},
{code:"", url:"http://www.hymans.se", target:'blank', status:'Tillbaka till startsidan', image:'bilder/meny/hem.gif', oimage:'bilder/meny/hemo.gif', imgsize:[20,70]},
{code:"Tyra":"", url:"pages/start.htm", target:'blank', status:'Tillbaka till startsidan', image:'bilder/meny/start.gif', oimage:'bilder/meny/starto.gif', imgsize:[20,70],
sub:[
{"itemoff":[19,0]},
{code:"Size",
sub:[
{"leveloff":[0,69], "itemoff":[19,0]},
{code:"None", "format":{"size":[20,70], "style":STYLE1, status:'Tillbaka till startsidan'}},
{code:"Tiny", "format":{"size":[20,70], "style":STYLE2}},
{code:"Small", "format":{"size":[20,70], "style":STYLE2}},
{code:"Medium", "format":{"size":[20,70], "style":STYLE2}},
{code:"Large", "format":{"size":[20,70], "style":STYLE3}}
]
},
{code:"Color",
sub:[
{"leveloff":[0,69], "itemoff":[19,0]},
{code:"None", "format":{"size":[20,70], "style":STYLE1, status:'Tillbaka till Framtiden'}},
{code:"Tiny", "format":{"size":[20,70], "style":STYLE2}},
{code:"Small", "format":{"size":[20,70], "style":STYLE2}},
{code:"Medium", "format":{"size":[20,70], "style":STYLE2}},
{code:"Large", "format":{"size":[20,70], "style":STYLE3}}
]
}
]
},
{code:"Jobb",
sub:[
{"itemoff":[19,0]},
{code:"Size",
sub:[
{"leveloff":[0,69], "itemoff":[19,0]},
{code:"None", "format":{"size":[20,70], "style":STYLE1, status:'Kolla in detta va'}},
{code:"Tiny", "format":{"size":[20,70], "style":STYLE2}},
{code:"Small", "format":{"size":[20,70], "style":STYLE2}},
{code:"Medium", "format":{"size":[20,70], "style":STYLE2}},
{code:"Large", "format":{"size":[20,70], "style":STYLE3}}
]
},
{code:"Color",
sub:[
{"leveloff":[0,69], "itemoff":[19,0]},
{code:"None", "format":{"size":[20,70], "style":STYLE1, status:'Tillbaka till Framtiden'}},
{code:"Tiny", "format":{"size":[20,70], "style":STYLE2}},
{code:"Small", "format":{"size":[20,70], "style":STYLE2}},
{code:"Medium", "format":{"size":[20,70], "style":STYLE2}},
{code:"Large", "format":{"size":[20,70], "style":STYLE3}}
]
}
]
}
];
var m1 = new COOLjsMenuPRO("menu1", MENU_ITEMS);
m1.initTop();
Thanks in advance for any help!
LAMF |
|
| Back to top |
|
 |
AlexKunin Developer
Joined: 03 Jan 2003 Posts: 1191
|
Posted: Sun Feb 25, 2007 9:47 pm Post subject: |
|
|
| Quote: | | ...code:"Tyra":"", url... |
There is some error with the second pair of quotes.
I suggest you to use code/ocode instead of image/oimage:
| Code: | | {code:'<img src="..." width="..." height="..." />', ocode:'<img src="..." width="..." height="..." />', ...}, |
|
|
| Back to top |
|
 |
LAMF
Joined: 25 Feb 2007 Posts: 3
|
Posted: Tue Feb 27, 2007 7:42 am Post subject: |
|
|
| AlexKunin wrote: | | Quote: | | ...code:"Tyra":"", url... |
There is some error with the second pair of quotes.
I suggest you to use code/ocode instead of image/oimage:
| Code: | | {code:'<img src="..." width="..." height="..." />', ocode:'<img src="..." width="..." height="..." />', ...}, |
|
Thanks for suggestion but it doesn't work for me...
I have tried this:
var MENU_ITEMS = [
{"pos":[0,0], "itemoff":[0,69], "leveloff":[19,0], "style":STYLE, "size":[20,70]},
{code:url:"index.html", status:'Tillbaka till startsidan', '<img src="bilder/meny/hem.gif" width="70" height="20" />', ocode:'<img src="bilder/meny/hemo.gif" width="70" height="20" />'},
{code:url:"tyra/", status:'Here we go', '<img src="bilder/meny/tyra.gif" width="70" height="20" />', ocode:'<img src="bilder/meny/tyrao.gif" width="70" height="20" />',
sub:[
{"itemoff":[19,0]},
{code:"Size", "format":{"size":[20,70], "style":STYLE1,
What is wrong? |
|
| Back to top |
|
 |
LAMF
Joined: 25 Feb 2007 Posts: 3
|
Posted: Tue Feb 27, 2007 12:55 pm Post subject: |
|
|
I solved it, thanks Alex!
But now another little tricky one... If I want to position it centered....
It says the trick is to do like this:
{"pos":"relative",......}
And then use a table with center alignment... But this doesn't give any effect at all for me. |
|
| Back to top |
|
 |
AlexKunin Developer
Joined: 03 Jan 2003 Posts: 1191
|
Posted: Wed Feb 28, 2007 5:28 am Post subject: |
|
|
| Quote: | | {code:url:"index.html", status:'Tillbaka till startsidan', '<img src="bilder/meny/hem.gif" width="70" height="20" />' |
This part is completely wrong (violates syntax rules). It should be written like this:
| Code: | | {code:'<img src="bilder/meny/hem.gif" width="70" height="20" />', url:"index.html", status:'Tillbaka till startsidan', ... |
| Quote: | | And then use a table with center alignment... But this doesn't give any effect at all for me. |
It works perfectly for me. Please, give me something to look at. |
|
| Back to top |
|
 |
|
|