Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:31
Touble feeding more than one rawcss to the aI() function
Poster: restromania
Dated: Monday July 30 2007 - 4:13:48 BST
Hello!
I'm having a big problem feeding more than one rawcss parameter to the aI() function.
It's a pretty simple problem really, the aI is only taking one parameter:
Code:
aI("rawcss=margin-left:11px;text=" + document.title.toUpperCase() + ";itemheight=31;title=See Navigation Below!;);
If i try multiple rawcss or a "normal" string of parameters, then nothing happens. Just doesn't work:
Code:
aI("rawcss=margin-left:11px;rawcss=letter-spacing:-1px;text=" + document.title.toUpperCase() + ";itemheight=31;title=See Navigation Below!;);
or, even perhaps less likely to work:
aI("rawcss=margin-left:11px;letter-spacing:-1px;text=" + document.title.toUpperCase() + ";itemheight=31;title=See Navigation Below!;);
or, even perhaps less likely to work:
aI("rawcss=margin-left:11px;letter-spacing:-1px;text=" + document.title.toUpperCase() + ";itemheight=31;title=See Navigation Below!;);
It just seems sort of wierd or perhaps an oversight that rawcss can only handle a single set.
I mean, yes, of course I set up the rawcss string just fine in the style for that menu, that's not a problem:
Code:
...
fontfamily="Verdana";
fontsize="8pt";
fontstyle="normal";
fontweight="bold";
decoration="none";
rawcss="font-weight: 700;letter-spacing:-1px;word-spacing: 88%;line-height:88%;text-align:left;margin-left:46px;margin-right=6px;margin-top=0px;margin-bottom=0px;";
...
fontfamily="Verdana";
fontsize="8pt";
fontstyle="normal";
fontweight="bold";
decoration="none";
rawcss="font-weight: 700;letter-spacing:-1px;word-spacing: 88%;line-height:88%;text-align:left;margin-left:46px;margin-right=6px;margin-top=0px;margin-bottom=0px;";
...
It's just that when you send that only-one-allowed single rawcss for the aI() function, it cancels out all of the other rawcss declared in the style for the menu, which is, forgive me, a bit silly.
Any chance of a fix? Or am I missing some syntax here?
I could only suggest that the syntax for Milonic change for aI() to something like:
Quote:
aI("rawcss=attribute:value,attribute2:value2,attribute3:value3;text=textvalue;");
You can see my floating side menu at http://www.restromania.com/passports for example.
Thanks so much!
David Ciobanu
Poster: Ruth
Dated: Friday August 3 2007 - 8:22:05 BST
Hi,
I'll post this to Milonic. But, one thing I note is that in an aI string the menu uses ; between parameters, i.e. text=;url=; and so on, so if you need to use the semi-colon because you want more than one rawcss parameter wouldn't you have to somehow 'escape' that? I am not saying this will work, I was only wondering.... js is not my thing
Ruth
Ruth is Rather Clever!
Poster: restromania
Dated: Friday August 3 2007 - 10:35:16 BST
Thanks very much Ruth, it worked like a charm. You really are quite clever, it never occured to me to put a %3B instead of the ";" inside that one. I guess that will work for anything which needs multiple parameters then! GREAT!
I've now put for the rawcss string as follows for that aI() :
Code:
aI("align=center;rawcss=text-decoration: none %3B letter-spacing: 1px %3B margin-right:14px %3B margin-left:2px %3B margin-top: 0px %3B margin-bottom: 0px %3B ;text=<span class=flT12>" + showText + "</span>;url=#top;itemheight=28;title=See Navigation Below!;bgimage=SideTitleLink.png");
Notice that tags like <span>, <h3> and others work just fine. I use <span class=XXX> to control via a CSS the appearance of individual menu items.
You can see the results of YOUR GREAT TIP now at http://www.restromania.com/danubedelta!
THANKS SO MUCH, you're a treasure to Milonic!
David Ciobanu
Oh wait, no...
Poster: restromania
Dated: Saturday August 4 2007 - 2:52:12 BST
Oops, no, that %3B doesn't actually work, I spoke too soon, sometimes just the first one works with that, and I foolishly didn't test thoroughly
Anyways, I did get control of individual menu lines by using:
Code:
For the menu title (at the top of the vertical floating menu):
text=<div class=menutitle>MENU TITLE HERE</div>;
and then for other items, something like:
text=<div class=menuitem>Menu Item Here</div>;
That works just fine and is a good workaround for the single parameter rawcss problem when u need to maniuplate the menu item text appearance on a line-by-line basis.
You can see i did the top line as big bold white, and the rest of the sections and menu items in slightly different fonts at http://www.restromania.com/
Ruth, thanks again for the help!
ENJOY!
David Ciobanu
Poster: John
Dated: Monday August 6 2007 - 19:37:00 BST
You should (I think) be able to just double up on the ; at the end of the rawcss definition; e.g. -
Code:
aI("rawcss=margin-left:11px;letter-spacing:-1px;;text=" + document.title.toUpperCase() + ";itemheight=31;title=See Navigation Below!;);
Note the ;; after the -1px. This is the same method used after something like a & item. If it's at the end of a definition it needs to be &; to continue with other items in the aI string.
The Double Semi-Colon is the ANSWER!
Poster: restromania
Dated: Tuesday August 7 2007 - 1:50:47 BST
Bingo John. Worked great, very smart of you to make that connection.
Code:
aI("rawcss=text-decoration: underline;color: #0033CC;margin-left:27px;;itemheight=20;text=menutexthere;... ");
The double semi-colons worked great. We also use Romanian characters like "UPPER ARGE & # 3 5 0 ; " (the code makes an "s" with a cedilla on it) and in links for the url= tag such as "#Upper_Arge & # 3 5 1 ; _River_Region". (i had to put spaces in the codes to prevent the phpBB from translating to the real characters!!!).
Thanks to your tip John, I have simply replaced the semicolons with a double, which makes all of our special characters (such as "ă Î â ş ţ", called diacritice in Romanian) work just great!
Code:
url = ReplaceAll(url,";",";;");
text = ReplaceAll(text,";",";;");
text = ReplaceAll(text,";",";;");
Anyways, I strongly suggest that Milonic immediately include the double-semicolon trick in it's documentation. It's useful for both special characters used in menu items, as well as for multi-parameter properties for the aI() function.
Enjoy, and thanks again!
David