Screen Size Detection

T

Trevor

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
 
B

brucie

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
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.
 
L

Leif K-Brooks

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.
 
R

rf

Leif K-Brooks said:
(e-mail address removed) (Trevor) wrote in message

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 :)
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.
 
H

Hywel Jenkins

<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.
 
D

Dylan Parry

rf said:
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.
 
R

rf

Dylan Parry said:
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.
 
R

rf

Dylan Parry said:
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>

Cheers
Richard.
 
D

Dylan Parry

rf said:
<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!
 
R

rf

Dylan Parry said:
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.
 
T

Toby A Inkster

rf said:
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*. :)
 
D

Dylan Parry

William said:
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)
 
T

Trevor

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.
 
D

Daniel R. Tobias

Not said:
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)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top