sokpet Posted January 21, 2011 Share Posted January 21, 2011 HelloHow to implement conditional CSS depending on screen resolution using the following script? : [removed] var screenwidth = screen.width; if (screenwidth <= 1024) { [removed]('<link rel="stylesheet" href="global.css" type="text/css" media="screen" />'); } else { [removed]('<link rel="stylesheet" href="globalNEW.css" type="text/css" media="screen" />'); } [removed] Do I have to modify header.php and header.tpl or something esle? Link to comment Share on other sites More sharing options...
sokpet Posted January 22, 2011 Author Share Posted January 22, 2011 Nobody knows?Is it so difficult to do it? Link to comment Share on other sites More sharing options...
sokpet Posted January 22, 2011 Author Share Posted January 22, 2011 Well for the moment I made the changes only in header.tpl as follows:{literal} [removed] var screenwidth = screen.width; if (screenwidth <= 1024) {[removed]('<link href="http://myweb//themes/mytheme/css/global1.css" rel="stylesheet" type="text/css" />'); } else {[removed]('<link href="http://myweb//themes/mytheme/css/global.css" rel="stylesheet" type="text/css" />'); }[removed] {/literal}It works perfect. But I think it is a bit "dirty" way as it uses absolute links. So how to assign CSS variables {$css_url} and {$css_url1}???? and where??? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now