Login Register


Javascript and screen resolution filter_list
Author
Message
Javascript and screen resolution #1
Often, we have some problems with the screen resolution on Web Sites or Applications. Let’s imagine that we have created a very useful service for Web, created primarily for 1024px screen resolution or higher, with three columns of content, large images etc.., and it receives 10,000 hits daily. Cool

By analyzing the statistics system, we found that 30% of users who access our application use 800 x 600 resolution, and 8% are still using the resolution of 640 x 480 px. Certainly the level of rejection of such a system, however good are its features, will be high, because the experience that users will have will not be very pleasant. :oO:

To solve the problem, we use a simple feature, Java Script, causing the browser to recognize the resolution of an specific user and assign a specific CSS to that resolution. Let's start below:

Code:
<head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ /><title>Detecting screen resolution</title> <link rel=”stylesheet” href=”style.css” type=”text/css” media=”screen” /> <script type=”text/javascript” language=”javascript”> if (screen.width >= “1024″) { document.write(’<link rel=”stylesheet” href=”style.css” type=”text/css” />’) } else { document.write(’<link rel=”stylesheet” href=”style2.css” type=”text/css” />’) } </script> </head> <body> Your html here! </body> </html>

Enjoy! o/
Yar-har Fiddle-dee-dee, being a pirate is alright to be! Do what you want cause a pirate is free, you are a pirate! AHOY!


[Image: tumblr_m7isvt2N171ranhnao1_500.gif]

Reply

Javascript and screen resolution #2
Often, we have some problems with the screen resolution on Web Sites or Applications. Let’s imagine that we have created a very useful service for Web, created primarily for 1024px screen resolution or higher, with three columns of content, large images etc.., and it receives 10,000 hits daily. Cool

By analyzing the statistics system, we found that 30% of users who access our application use 800 x 600 resolution, and 8% are still using the resolution of 640 x 480 px. Certainly the level of rejection of such a system, however good are its features, will be high, because the experience that users will have will not be very pleasant. :oO:

To solve the problem, we use a simple feature, Java Script, causing the browser to recognize the resolution of an specific user and assign a specific CSS to that resolution. Let's start below:

Code:
<head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ /><title>Detecting screen resolution</title> <link rel=”stylesheet” href=”style.css” type=”text/css” media=”screen” /> <script type=”text/javascript” language=”javascript”> if (screen.width >= “1024″) { document.write(’<link rel=”stylesheet” href=”style.css” type=”text/css” />’) } else { document.write(’<link rel=”stylesheet” href=”style2.css” type=”text/css” />’) } </script> </head> <body> Your html here! </body> </html>

Enjoy! o/
Yar-har Fiddle-dee-dee, being a pirate is alright to be! Do what you want cause a pirate is free, you are a pirate! AHOY!


[Image: tumblr_m7isvt2N171ranhnao1_500.gif]

Reply

RE: Javascript and screen resolution #3
Nice piece of code. This will help others in learning web development and making flexible websites. Good work
[Image: OilyCostlyEwe.gif]

Reply

RE: Javascript and screen resolution #4
Nice piece of code. This will help others in learning web development and making flexible websites. Good work
[Image: OilyCostlyEwe.gif]

Reply

RE: Javascript and screen resolution #5
Quote:Nice piece of code. This will help others in learning web development and making flexible websites. Good work

thanks psycho! ^_^
Yar-har Fiddle-dee-dee, being a pirate is alright to be! Do what you want cause a pirate is free, you are a pirate! AHOY!


[Image: tumblr_m7isvt2N171ranhnao1_500.gif]

Reply

RE: Javascript and screen resolution #6
Quote:Nice piece of code. This will help others in learning web development and making flexible websites. Good work

thanks psycho! ^_^
Yar-har Fiddle-dee-dee, being a pirate is alright to be! Do what you want cause a pirate is free, you are a pirate! AHOY!


[Image: tumblr_m7isvt2N171ranhnao1_500.gif]

Reply

RE: Javascript and screen resolution #7
(07-15-2013, 10:06 PM)Megamente Wrote: Often, we have some problems with the screen resolution on Web Sites or Applications. Let’s imagine that we have created a very useful service for Web, created primarily for 1024px screen resolution or higher, with three columns of content, large images etc.., and it receives 10,000 hits daily. Cool

By analyzing the statistics system, we found that 30% of users who access our application use 800 x 600 resolution, and 8% are still using the resolution of 640 x 480 px. Certainly the level of rejection of such a system, however good are its features, will be high, because the experience that users will have will not be very pleasant. :oO:

To solve the problem, we use a simple feature, Java Script, causing the browser to recognize the resolution of an specific user and assign a specific CSS to that resolution. Let's start below:

Code:
<head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ /><title>Detecting screen resolution</title> <link rel=”stylesheet” href=”style.css” type=”text/css” media=”screen” /> <script type=”text/javascript” language=”javascript”> if (screen.width >= “1024″) { document.write(’<link rel=”stylesheet” href=”style.css” type=”text/css” />’) } else { document.write(’<link rel=”stylesheet” href=”style2.css” type=”text/css” />’) } </script> </head> <body> Your html here! </body> </html>

Enjoy! o/

Which is Better . .
Boostrap Or this Script

Reply

RE: Javascript and screen resolution #8
(07-15-2013, 10:06 PM)Megamente Wrote: Often, we have some problems with the screen resolution on Web Sites or Applications. Let’s imagine that we have created a very useful service for Web, created primarily for 1024px screen resolution or higher, with three columns of content, large images etc.., and it receives 10,000 hits daily. Cool

By analyzing the statistics system, we found that 30% of users who access our application use 800 x 600 resolution, and 8% are still using the resolution of 640 x 480 px. Certainly the level of rejection of such a system, however good are its features, will be high, because the experience that users will have will not be very pleasant. :oO:

To solve the problem, we use a simple feature, Java Script, causing the browser to recognize the resolution of an specific user and assign a specific CSS to that resolution. Let's start below:

Code:
<head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″ /><title>Detecting screen resolution</title> <link rel=”stylesheet” href=”style.css” type=”text/css” media=”screen” /> <script type=”text/javascript” language=”javascript”> if (screen.width >= “1024″) { document.write(’<link rel=”stylesheet” href=”style.css” type=”text/css” />’) } else { document.write(’<link rel=”stylesheet” href=”style2.css” type=”text/css” />’) } </script> </head> <body> Your html here! </body> </html>

Enjoy! o/

Which is Better . .
Boostrap Or this Script

Reply

RE: Javascript and screen resolution #9
I think bootsrap or another css framework is better if you will develop a big responsive website, personally I will use that script to make some tricks in the page..

Reply

RE: Javascript and screen resolution #10
I think bootsrap or another css framework is better if you will develop a big responsive website, personally I will use that script to make some tricks in the page..

Reply







Users browsing this thread: