NetTalk Central

Author Topic: Detect Browse Width  (Read 2482 times)

gavinwebb

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • Email
Detect Browse Width
« 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.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Detect Browse Width
« Reply #1 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