Screen Size Detection

Discussion in 'HTML' started by Trevor, Sep 20, 2003.

  1. Trevor

    Trevor Guest

    Problem
    =======

    I am trying to implement a fading image across a web screen, but I
    have not implemented anything to handle different sizes of images.

    My site is at avidom.co.uk.

    Methods
    =======

    Currently, the screen has a strip repeated as a background, 800 px
    wide. But what I need is implemented logic saying:

    getScreenSize(userScreen)
    if 800px use 800pxImage
    else if 1200px use 1200pxIm

    etc

    Other sites use an array of images to build up a picture, eg
    newbright.com
    Trevor, Sep 20, 2003
    #1
    1. Advertising

  2. Trevor

    brucie Guest

    In post <>
    Trevor said...

    > I am trying to implement a fading image across a web screen, but I
    > have not implemented anything to handle different sizes of images.


    don't use different sized images. stick the image in a container like
    a <div> with the container and image at 100% width. z-index the rest
    of the site to be above the container with the image.

    > Currently, the screen has a strip repeated as a background, 800 px
    > wide. But what I need is implemented logic saying:
    >
    > getScreenSize(userScreen)
    > if 800px use 800pxImage
    > else if 1200px use 1200pxIm


    for people with multi monitor systems only the primary monitor
    resolution is returned. 1) the browser may be on a different monitor.
    2) it may be on more than one monitor. 3) just because a screen
    resolution is 1600x1200 (for example) doesn't in any way mean the
    available canvas area of the browser is anywhere near that size. the
    higher the resolution the more likely that it isn't going to be.
    brucie, Sep 20, 2003
    #2
    1. Advertising

  3. (Trevor) wrote in message news:<>...
    > Problem
    > =======
    >
    > I am trying to implement a fading image across a web screen, but I
    > have not implemented anything to handle different sizes of images.
    >
    > My site is at avidom.co.uk.
    >
    > Methods
    > =======
    >
    > Currently, the screen has a strip repeated as a background, 800 px
    > wide. But what I need is implemented logic saying:
    >
    > getScreenSize(userScreen)
    > if 800px use 800pxImage
    > else if 1200px use 1200pxIm
    >
    > etc
    >
    > Other sites use an array of images to build up a picture, eg
    > newbright.com


    That would be impossible, since there are infinite browser window
    sizes. You'd be better off giving it up and using a solid color or
    nicely repeating image.
    Leif K-Brooks, Sep 20, 2003
    #3
  4. Trevor

    rf Guest

    "Leif K-Brooks" <> wrote in message
    news:...
    > (Trevor) wrote in message

    news:<>...
    > > Problem
    > > =======
    > >
    > > I am trying to implement a fading image across a web screen, but I
    > > have not implemented anything to handle different sizes of images.
    > >
    > > My site is at avidom.co.uk.
    > >
    > > Methods
    > > =======
    > >
    > > Currently, the screen has a strip repeated as a background, 800 px
    > > wide. But what I need is implemented logic saying:
    > >
    > > getScreenSize(userScreen)
    > > if 800px use 800pxImage
    > > else if 1200px use 1200pxIm
    > >
    > > etc
    > >
    > > Other sites use an array of images to build up a picture, eg
    > > newbright.com

    >
    > That would be impossible, since there are infinite browser window
    > sizes.


    <pedantic>
    Nope.
    Given my desktop size (3200x1200) I get, er, only 3.84 milliions diffrerent
    canvas sizes.
    A long way from infinity :)
    </pedantic>

    > You'd be better off giving it up and using a solid color or
    > nicely repeating image.


    Nope. brucies solution is valid. An image stretched to the browsers canvas
    dimensions and in the background. I have done this before:

    http://users.bigpond.net.au/rf/tricks/rainbows2.htm

    Note: some browsers don't like negative z-indexes. Leave the bacground
    images z-index at 0 and move the rest of the page positive.

    Cheers
    Richard.
    rf, Sep 20, 2003
    #4
  5. In article <Q3Wab.113635$>,
    says...
    >
    > "Leif K-Brooks" <> wrote in message
    > news:...
    > > (Trevor) wrote in message

    > news:<>...
    > > > Problem
    > > > =======
    > > >
    > > > I am trying to implement a fading image across a web screen, but I
    > > > have not implemented anything to handle different sizes of images.
    > > >
    > > > My site is at avidom.co.uk.
    > > >
    > > > Methods
    > > > =======
    > > >
    > > > Currently, the screen has a strip repeated as a background, 800 px
    > > > wide. But what I need is implemented logic saying:
    > > >
    > > > getScreenSize(userScreen)
    > > > if 800px use 800pxImage
    > > > else if 1200px use 1200pxIm
    > > >
    > > > etc
    > > >
    > > > Other sites use an array of images to build up a picture, eg
    > > > newbright.com

    > >
    > > That would be impossible, since there are infinite browser window
    > > sizes.

    >
    > <pedantic>
    > Nope.
    > Given my desktop size (3200x1200) I get, er, only 3.84 milliions diffrerent
    > canvas sizes.
    > A long way from infinity :)
    > </pedantic>


    Indeed - it's not even half-way there.

    --
    Hywel I do not eat quiche
    http://hyweljenkins.co.uk/
    http://hyweljenkins.co.uk/mfaq.php
    Hywel Jenkins, Sep 20, 2003
    #5
  6. Trevor

    rf Guest

    "Hywel Jenkins" <> wrote in message
    news:...

    > > > That would be impossible, since there are infinite browser window
    > > > sizes.

    > >
    > > <pedantic>
    > > Nope.
    > > Given my desktop size (3200x1200) I get, er, only 3.84 milliions

    diffrerent
    > > canvas sizes.
    > > A long way from infinity :)
    > > </pedantic>

    >
    > Indeed - it's not even half-way there.


    Not even half of that.

    Cheers
    Richard.
    rf, Sep 20, 2003
    #6
  7. Trevor

    Dylan Parry Guest

    rf wrote:

    >>> A long way from infinity :)

    >>
    >> Indeed - it's not even half-way there.

    >
    > Not even half of that.


    I try not to think of things like that, they just confuse the jeebers out
    of me! Infinity/2=Infinity... too much to have to comprehend.

    --
    Dylan Parry
    http://www.webpageworkshop.co.uk - FREE Web tutorials and references
    Dylan Parry, Sep 20, 2003
    #7
  8. Trevor

    rf Guest

    "Dylan Parry" <> wrote in message
    news:p...
    > rf wrote:
    >
    > >>> A long way from infinity :)
    > >>
    > >> Indeed - it's not even half-way there.

    > >
    > > Not even half of that.

    >
    > I try not to think of things like that, they just confuse the jeebers out
    > of me! Infinity/2=Infinity... too much to have to comprehend.


    Quite simple really Dylan. There are, in fact, an infinite number of
    infinite numbers. They are, in the mathematics, represented by the greek
    (IIRC) name alpeph. The numbers are aleph0, apeph1, ... There are (once
    again IIRC) aleph0 infinite numbers.

    The number of counting numbers (0, 1, 2 ...) is of course aleph0. The number
    of possible canvas widths, assuming an infinite screen, is therefore aleph0.
    However, the possible number of canvas areas is also aleph0 since aleph0 *
    alpeh0 = aleph0.

    To get to the next one we have to consider the real numbers, assuming we can
    have pixel widths like 1.3(repeat) (1.33333 -> forever) (meaning one third
    of four pixels). We recall that for each pair of such pixels pixels there
    are an infinite number of other pixels in between them. We then realize that
    such pixels are an order of magnitude (in the transfinite arithmetical
    sense) more numerous than ordanary integrally restricted pixels. Thus, we
    decide that there must be aleph1 real numbers pixels.

    To get to the next one we must consider the complex numbers, you know, the
    ones like 1+sqrt(-1), usually expressed as x+iy, where i == sqrt(-1). For
    each real number x (of which there are aleph1) there are an infinite number
    (actually alpeh1) of complex numbers of the form x+y*sqrt(-1) where y
    varies. So, there are exactly aleph2 complex numbers. Such things cannot be
    envisaged as being pixels however.

    We can recurse this an infinite number of times.

    Yeah I know, it's a slow night.

    Cheers
    Richard.
    rf, Sep 20, 2003
    #8
  9. Trevor

    Dylan Parry Guest

    rf wrote:

    <snip drivel />
    > Yeah I know, it's a slow night.


    Heh! It must be to have come up with all that drivel!

    --
    Dylan Parry
    http://www.webpageworkshop.co.uk - FREE Web tutorials and references
    Now playing: Nyman - The Piano
    Dylan Parry, Sep 20, 2003
    #9
  10. Trevor

    rf Guest

    "Dylan Parry" <> wrote in message
    news:p...
    > rf wrote:
    >
    > <snip drivel />
    > > Yeah I know, it's a slow night.

    >
    > Heh! It must be to have come up with all that drivel!


    <grin>
    That is in fact not drivel. I did a unit a university called "transfinite
    arithmetic" wherein we actually did learn that alpeh0 / 2 == aleph0. I find
    that this is the first time since that I have actualy used that knowledge to
    some advantage, if that is only to ...
    </grin>

    Cheers
    Richard.
    rf, Sep 20, 2003
    #10
  11. Trevor

    Dylan Parry Guest

    rf wrote:

    >> Heh! It must be to have come up with all that drivel!

    >
    > <grin>
    > That is in fact not drivel. I did a unit a university called
    > "transfinite arithmetic" wherein we actually did learn that alpeh0 / 2
    > == aleph0. I find that this is the first time since that I have actualy
    > used that knowledge to some advantage, if that is only to ... </grin>


    True or not, it was still regurgitated drivel ;o) You know I thought that
    some of my University modules were useless, but after hearing about yours,
    I feel I got the better bargain!

    --
    Dylan Parry
    http://www.webpageworkshop.co.uk - FREE Web tutorials and references
    Now playing: Rachmaninov - Piano Concerto No.3
    Dylan Parry, Sep 20, 2003
    #11
  12. Trevor

    rf Guest

    "Dylan Parry" <> wrote in message
    news:p...
    > rf wrote:
    >
    > >> Heh! It must be to have come up with all that drivel!

    > >
    > > <grin>
    > > That is in fact not drivel. I did a unit a university called
    > > "transfinite arithmetic" wherein we actually did learn that alpeh0 / 2
    > > == aleph0. I find that this is the first time since that I have actualy
    > > used that knowledge to some advantage, if that is only to ... </grin>

    >
    > True or not, it was still regurgitated drivel ;o) You know I thought that
    > some of my University modules were useless, but after hearing about yours,
    > I feel I got the better bargain!


    Pretty close to the truth :)

    Cheers
    Richard.
    rf, Sep 20, 2003
    #12
  13. "rf" <> wrote in message
    news:79Yab.113953$...
    >
    > "Dylan Parry" <> wrote in message
    > news:p...
    > > rf wrote:
    > >
    > > >> Heh! It must be to have come up with all that drivel!
    > > >
    > > > <grin>
    > > > That is in fact not drivel. I did a unit a university called
    > > > "transfinite arithmetic" wherein we actually did learn that alpeh0 / 2
    > > > == aleph0. I find that this is the first time since that I have

    actualy
    > > > used that knowledge to some advantage, if that is only to ... </grin>

    > >
    > > True or not, it was still regurgitated drivel ;o) You know I thought

    that
    > > some of my University modules were useless, but after hearing about

    yours,
    > > I feel I got the better bargain!

    >
    > Pretty close to the truth :)
    >


    Have you guys run out of beer or something ?? :)
    Not in my trousers, Sep 20, 2003
    #13
  14. rf wrote:

    > That is in fact not drivel. I did a unit a university called "transfinite
    > arithmetic" wherein we actually did learn that alpeh0 / 2 == aleph0.


    Hehe... I did that is *high school*. :)

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?id=132
    playing://coldplay/parachutes/04_sparks.ogg
    Toby A Inkster, Sep 20, 2003
    #14
  15. Toby A Inkster wrote:
    > rf wrote:
    >
    >> That is in fact not drivel. I did a unit a university called
    >> "transfinite arithmetic" wherein we actually did learn that alpeh0 /
    >> 2 == aleph0.

    >
    > Hehe... I did that is *high school*. :)


    I didn't - not telling[1] what I did at senior school

    [1] in case my mother starts reading usenet ;o)
    --
    William Tasso - http://WilliamTasso.com
    William Tasso, Sep 20, 2003
    #15
  16. Trevor

    Dylan Parry Guest

    William Tasso wrote:

    > I didn't - not telling[1] what I did at senior school
    >
    > [1] in case my mother starts reading usenet ;o)


    Your mother already knows what you got up to, William. Don't think you can
    hide things from her... ;o)

    --
    Dylan Parry
    http://www.webpageworkshop.co.uk - FREE Web tutorials and references
    Dylan Parry, Sep 20, 2003
    #16
  17. Trevor

    Trevor Guest

    "rf" <> wrote in message news:<Q3Wab.113635$>...
    > "Leif K-Brooks" <> wrote in message
    > news:...
    > > (Trevor) wrote in message

    > news:<>...
    > > > Problem
    > > > =======
    > > >
    > > > I am trying to implement a fading image across a web screen, but I
    > > > have not implemented anything to handle different sizes of images.
    > > >
    > > > My site is at avidom.co.uk.
    > > >
    > > > Methods
    > > > =======
    > > >
    > > > Currently, the screen has a strip repeated as a background, 800 px
    > > > wide. But what I need is implemented logic saying:
    > > >
    > > > getScreenSize(userScreen)
    > > > if 800px use 800pxImage
    > > > else if 1200px use 1200pxIm
    > > >
    > > > etc
    > > >
    > > > Other sites use an array of images to build up a picture, eg
    > > > newbright.com

    > >
    > > That would be impossible, since there are infinite browser window
    > > sizes.

    >
    > <pedantic>
    > Nope.
    > Given my desktop size (3200x1200) I get, er, only 3.84 milliions diffrerent
    > canvas sizes.
    > A long way from infinity :)
    > </pedantic>
    >
    > > You'd be better off giving it up and using a solid color or
    > > nicely repeating image.

    >
    > Nope. brucies solution is valid. An image stretched to the browsers canvas
    > dimensions and in the background. I have done this before:
    >
    > http://users.bigpond.net.au/rf/tricks/rainbows2.htm


    This is quite brilliant, I don't how it works or when it fails, but it looks good.



    >
    > Note: some browsers don't like negative z-indexes. Leave the bacground
    > images z-index at 0 and move the rest of the page positive.
    >
    > Cheers
    > Richard.
    Trevor, Sep 20, 2003
    #17
  18. Trevor

    Trevor Guest

    (Leif K-Brooks) wrote in message news:<>...
    > (Trevor) wrote in message news:<>...
    > > Problem
    > > =======
    > >
    > > I am trying to implement a fading image across a web screen, but I
    > > have not implemented anything to handle different sizes of images.
    > >
    > > My site is at avidom.co.uk.
    > >
    > > Methods
    > > =======
    > >
    > > Currently, the screen has a strip repeated as a background, 800 px
    > > wide. But what I need is implemented logic saying:
    > >
    > > getScreenSize(userScreen)
    > > if 800px use 800pxImage
    > > else if 1200px use 1200pxIm
    > >
    > > etc
    > >
    > > Other sites use an array of images to build up a picture, eg
    > > newbright.com

    >
    > That would be impossible, since there are infinite browser window
    > sizes. You'd be better off giving it up and using a solid color or
    > nicely repeating image.


    You make a good point here, but the toy industry likes fading colours
    as they present something more fun like for children. Most toy sites
    have something more fun than plain colour, see

    http://www.hornbyrailways.com/pages/home.aspx

    for example.
    Trevor, Sep 20, 2003
    #18
  19. Not in my trousers wrote:
    > Have you guys run out of beer or something ?? :)


    Aleph-null bottles of beer on the wall,
    Aleph-null bottles of beer
    If one of those bottles should happen to fall
    Aleph-null bottles of beer on the wall!

    (repeat forever)

    --
    == Dan ==
    Dan's Mail Format Site: http://mailformat.dan.info/
    Dan's Web Tips: http://webtips.dan.info/
    Dan's Domain Site: http://domains.dan.info/
    Daniel R. Tobias, Sep 20, 2003
    #19
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GMK
    Replies:
    1
    Views:
    2,236
    =?Utf-8?B?RG90TmV0SmVyb21l?=
    Feb 26, 2005
  2. Piet
    Replies:
    0
    Views:
    409
  3. E. Kwong
    Replies:
    1
    Views:
    404
    =?ISO-8859-1?Q?G=F6ran_Andersson?=
    Nov 7, 2006
  4. Ben Baker

    -> SCREEN READER DETECTION <-

    Ben Baker, Jul 12, 2004, in forum: Javascript
    Replies:
    2
    Views:
    122
    Java script Dude
    Jul 12, 2004
  5. ashore

    Screen Width Detection

    ashore, Mar 25, 2008, in forum: Javascript
    Replies:
    10
    Views:
    186
    Henry
    Mar 25, 2008
Loading...

Share This Page