NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: gavinwebb on April 07, 2012, 12:23:13 AM

Title: Detect Browse Width
Post by: gavinwebb on April 07, 2012, 12:23:13 AM
I have a browse on a window and just above that browse a display field that I'm using to show help text.
Ideally I want the display box to be the same width as the browse box as it looks better.

I have two questions:
a) Is there a way to return the width of the browse when it get's rendered and;
b) How can I then dynamically tell the display to use the same width

I have a custom CSS class for the display field.
Title: Re: Detect Browse Width
Post by: Bruce on April 08, 2012, 09:52:54 PM
you'd need to do it with JavaScript.

but bear in mind that the browse could change width - if for example you went to the "next" page, and it decided it needed more space.

This is out my head, so you may need to adjust a bit;

p_web.script('$("#displayid").width($("#browseid").width());')

where displayid, and browseid are the id's of the respective fields. (The browse has a div around it with the correct size.) You will need to use Firebug to see what the names are. Also, remember, it is case sensitive.

You can embed the above line in one of the "value" routines - I'd probably add it to the Display, or Browse, Value routine.

Cheers
Bruce