Forums Archive Index > SmartMenus 5 > Exclude drop-down menu from text resizer

Author: st.andrew

Date: 25 Sep 2005 5:59 pm

I am using a text resizer. How can I exclude the drop-down menu results so the font size doesn't change? Thanks.


//Specify affected tags. Add or remove from list:
var tgs = new Array( 'div','td','tr');


//Specify spectrum of different font sizes:
var szs = new Array( 'x-small','small', 'medium');
var startSz = 0;

function ts( trgt,inc ) {
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;

sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > 2 ) sz = 2;
startSz = sz;

if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}


Author: smartmenus

Date: 27 Sep 2005 4:36 am

I think the following is the easiest solution:

1) Put the link to the SmartMenus loader script right after your opening body tag.

2) Wrap your page content in a new div tag like this:

-------
<body>

<script type="text/javascript" language="JavaScript1.2" src="s_loader.js"></script>

<div id="container">
.... YOUR PAGE CONTENT GOES HERE ....
</div>

</body>
-------

After that call the function for text resizing like this- ts('container',X). Not like this- ts('body',X).

Btw, your code is a bit broken. The opening html tag appears after the start of the head section. Also I didn't see a closing body and html tags. It's a good idea to fix these.


Author: st.andrew

Date: 28 Sep 2005 4:35 pm

Thanks - it worked! I wish I understood why. I know just enough code to be dangerous! Any ideas on including translation to submenu? Also thanks for the BTWs.