Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / help implement scrip to load stylesheet depending on the user's screen resolution

help implement scrip to load stylesheet depending on the user's screen resolution

Locked

Views: 1,894

Results 1 to 7 of 7
This thread is locked. New replies are disabled.
27 Mar 2009, 3:37 PM
#1
abel2b avatar

abel2b

New Zenner

Join Date:
Mar 2009
Location:
South America
Posts:
3
Plugin Contributions:
0

help implement scrip to load stylesheet depending on the user's screen resolution

Hi, first time user of zen cart 1.3.8.

I am getting ready to implent it, as my business home page, but first I want to change it´s looks to my taste.

Obviosly I´m not into web development, so I´m a complete noob at coding but I am persistent and I apreciate a bit more detailed help.

I want zen cart to automatically load a style sheet depending on users screen resolution, with the hopes to avoid the problem of graphics, logos and banner looking cut up or wrong, I tried the sliding door technique, but couldn´t get results I wanted because graphics design has to be a certain way.

I´ve used the code below on a simple html test page and worked pretty good. Yet I dont´t know where or how to implement it in zen cart.

**<HEAD>

<script type="text/javascript"> <!-- Begin /* Created by: Bob Pearson :: <http://www.pagecraft.on.ca> */ var winW = 0, winH = 0; if (parseInt(navigator.appVersion)>3) { if (navigator.appName=="Netscape") { winW = window.innerWidth-16; winH = window.innerHeight-16; } if (navigator.appName.indexOf("Microsoft")!=-1) { winW = document.body.offsetWidth; winH = document.body.offsetHeight; } } if (winW <= 1600) { document.write('<link rel="stylesheet" type="text/css" href="1600_stylesheet.css">'); } if (winW <= 1280) { document.write('<link rel="stylesheet" type="text/css" href="1280_stylesheet.css">'); } if (winW <= 1024) { document.write('<link rel="stylesheet" type="text/css" href="1024_stylesheet.css">'); } if (winW <= 800) { document.write('<link rel="stylesheet" type="text/css" href="800_stylesheet.css">'); } if (winW <= 640) { document.write('<link rel="stylesheet" type="text/css" href="640_stylesheet.css">'); } // End --> </script>**

PS: Please excuse my english, I´m a bit rusty !!! :no:

1 Apr 2009, 2:03 PM
#2
abel2b avatar

abel2b

New Zenner

Join Date:
Mar 2009
Location:
South America
Posts:
3
Plugin Contributions:
0

Re: help implement scrip to load stylesheet depending on the user's screen resolution

well no luck here :yuck:, lets try magento see what happens

1 Apr 2009, 2:49 PM
#4
abel2b avatar

abel2b

New Zenner

Join Date:
Mar 2009
Location:
South America
Posts:
3
Plugin Contributions:
0

Re: help implement scrip to load stylesheet depending on the user's screen resolution

well no luck here , lets try magento see what happens :oops:

Thank you very much for the info I apreciate your response I really wanted continue using zencart.

Yes I´ve read the docs folder read_me_jscript.html and my only doubt is where is the stylesheet first loaded ?, what file should I edit to comment out that part and let the script kickin, or should I just create jscript_css loader.js and add it to includes/templates/{template_directory}/jscript/

1 Apr 2009, 9:40 PM
#5
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: help implement scrip to load stylesheet depending on the user's screen resolution

Just create a new file (the 2nd option you listed)

1 Apr 2009, 9:47 PM
#6
fairestcape avatar

fairestcape

Totally Zenned

Join Date:
Mar 2008
Location:
Cape Town &amp; London (depends on the season)
Posts:
2,957
Plugin Contributions:
0

Re: help implement scrip to load stylesheet depending on the user's screen resolution

I think you'll find Magento more limiting - and perhaps more frustrating! :D

2 Apr 2009, 12:53 AM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: help implement scrip to load stylesheet depending on the user's screen resolution

You would not want to disable or replace the existing stylesheet-loading mechanism, as it does many things automatically that you might want, including language style selection.

You could have the width-specific stylesheets contain only rules that vary depending on the browser, leaving all of the common rules in the original stylesheet. This will simplify any future style edits - imagine changing colors for one element in five different stylesheets! Now imagine making twenty changes in each of five different stylesheets, and keeping all of them synchronized...