Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19557

Re: This example works fine if I don't resize the browser window ar

From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: This example works fine if I don't resize the browser window ar
Date 2013-05-01 22:37 +0200
Organization albasani.net
Message-ID <klrueb$fdi$1@news.albasani.net> (permalink)
References <klro6t$opr$1@dont-email.me>

Show all headers | View raw


On 2013-05-01 20:54, Tony wrote:
> So as I said in the subject of this mail this example works as long as I 
> don't change the size of the browser window.
...
> So if the user changes the browser window the div must still correspond  to 
> the time axes and start at the correct  time.
...
> So I wonder how can I accomplish this with CSS ?
...
> Below is the java script code and HTML markup.

Looks familiar. I'm afraid I'm too busy to adjust the example, but I can
tell you what you need to do:

>     function addSlot (track, cls, minStart, minEnd) {
>         var unit = track.offsetWidth / (NUM_HOURS * 60),
>             slot = document.createElement("div");
>         slot.className = "slot " + cls;
>         slot.style.left = Math.round(unit * minStart) + "px";
>         slot.style.width = Math.round(unit * (minEnd - minStart)) + "px";
>         track.appendChild(slot);
>     }

In this function, you'll need to change the "left" and "width" styles to
use a percentage of the track.offsetWidth instead of a fixed number of
pixels.

The quick and lazy workaround is to simply demand the full width and
prevent the table from shrinking when the user resizes the window.
(A <div> with a fixed minimum width around the table should do it, I think.)

- stefan

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

This example works fine if I don't resize the browser window ar "Tony" <tony.johansson@inport.com> - 2013-05-01 20:54 +0200
  Re: This example works fine if I don't resize the browser window ar Stefan Weiss <krewecherl@gmail.com> - 2013-05-01 22:37 +0200

csiph-web