Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website Design Forum


You are currently viewing our Website Design Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Resolution Detection, Image Swapping
Old 03-31-2005, 01:00 AM Resolution Detection, Image Swapping
Luckboy's Avatar
Junior Talker

Posts: 1
Trades: 0
A while back I saw a javascript that would swap out images of different sizes based upon the size of the browser window. Do any of you have a copy of that script, and is that technology reliable?
Luckboy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-31-2005, 03:02 PM
pappasaa's Avatar
Ultra Talker

Posts: 268
Trades: 0
you can use a javascript a sniffer that detects the page size, then based on that redirects them to a page that will fit their resolution. It's kind of a painful way of getting around that problem, because you would have to make 3 different websites with different sizes.... if you dont want to do that just make your page compatible for 1024x768 and most people wont have a problem with it.


Code:
<script language="text/javascript"> 
<!-- 
if(screen.width>=1280||screen.height>=1024){ 
var sTargetURL = "bigscreen.html"; 
}else if(screen.width=1024||screen.height=768){ 
var sTargetURL = "normalscreen.html"; 
}else if (scren.width<=800||screen.height<=600){ 
var sTargetURL = "smallscreen.html"; 
}else{ 
var sTargetURL = "normalscreen.html"; 
alert("Your current resolution settings do not match the content of this page.  Your current resolution is "+screen.width+" by "+screen.height+".  If possible please change your resolution to either 800x600, 1024x768, or 1280x1024."); 
} 

function doRedirect() 
{ 
    setTimeout( "window.location.href = sTargetURL", 500 ); 
} 

//--> 
</script> 

<body onload="doRedirect()">
if i got all that correctly, what it should do is check the resolution, if it is 1280x1024 or higher, it will redirect to bigscreen.html. if it is 1024x768, normalscreen.html, and if equal to or less than 800x600, smallscreen.html. If the user has a resolution somewhere in-between those three then it will politeley send an alert telling them that their resolution is different than what is best for the page, and ask them to change to one of the three choices.

what you need to do, is make those three pages, and put the function "doRedirect()" in the onLoad of your body tag.
__________________
visit my link...um...nevermind
pappasaa is offline
Reply With Quote
View Public Profile Visit pappasaa's homepage!
 
Old 03-31-2005, 03:17 PM
brokensoul2271's Avatar
- - - - - - - - -

Posts: 750
Location: Lancashire, UK
Trades: 0
http://webreference.com/programming/javascript/images/ -might help...
__________________
Yes, indeed...

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
Old 03-31-2005, 04:21 PM
pappasaa's Avatar
Ultra Talker

Posts: 268
Trades: 0
brokensoul2271

i like that tutorial but do you know if it will work in other browsers besides ie and netscape? Looks like it will just ignore if its not ie or nescape. just a question. I am going to test it out
__________________
visit my link...um...nevermind
pappasaa is offline
Reply With Quote
View Public Profile Visit pappasaa's homepage!
 
Old 03-31-2005, 04:23 PM
brokensoul2271's Avatar
- - - - - - - - -

Posts: 750
Location: Lancashire, UK
Trades: 0
i really dont know... please let me know after you have tested it
__________________
Yes, indeed...

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
Old 03-31-2005, 04:31 PM
pappasaa's Avatar
Ultra Talker

Posts: 268
Trades: 0
i will check it out and get back to you
__________________
visit my link...um...nevermind
pappasaa is offline
Reply With Quote
View Public Profile Visit pappasaa's homepage!
 
Reply     « Reply to Resolution Detection, Image Swapping
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22557 seconds with 12 queries