Help the evolution of the CSS based on the resolution of the monitor

Hello!

So I thought it would be cool to have some sort of javascript that would change the CSS based on what users monitor resolution was.  I undertook research on google and found this:

http://www.Warriorforum.com/website-design/10031-script-load-different-CSS-depending-scree n - resolution.html

Change what I needed to I came up with this code:

< script type = "text/javascript" >

function getcss (cssfile) {}
loadcss = document.createElement ('link')
loadcss.setAttribute ("rel", "stylesheet")
loadcss.setAttribute ("type", "text/css")
loadcss.setAttribute ("href", cssfile)
document.getElementsByTagName ("head") [0] .appendChild (loadcss)
}

If (screen.width < = "800")
Sets the range of resolution you target (less than 800 pixels wide in this case)

{
getCss('css/800m.css')
Sets the .css file that you want to load for this range (css/800.css)
}

ElseIf (screen.width > '1024' & & screen.width < '1152')
This time, we are targeting all resolutions between 1024 and 1152 pixels wide

{
getCss('css/1024m.css')
And we want to load the .css file named ' css/1024.css.
}

ElseIf (screen.width > '1280' & & screen.width < '1360')
This time, we are targeting all resolutions between 1360 and 1280 pixels wide

{
getCss('css/1280m.css')
And we want to load the .css file named ' css/1280.css.
}

ElseIf (screen.width > '1440' & & screen.width < '1600')
This time, we are targeting all resolutions between 1440 and 1600 pixels wide

{
getCss('css/1440m.css')
And we want to load the .css file named ' css/1440.css.
}

on the other

{
getCss('css/1680m.css')
This else a condition 'if' statement If any of the following criteria are met, load css/1680m.css
}

< /script >


So far, the following resolutions work:

800 x 600

1360 x 768

1440 x 900

But the resolutions

1024 x 768

1152 x 648

1152 x 864

1280 x 720
1280 x 768
1280 x 800
1280 x 900

Do not.  They all have a site that is too big.  My CSS for these resolutions (1024 and 1280) are very good and have no problems.  So I think that something is wrong with my JS.  I'm not a JS expert so I hope that I do not something to spoil.

Any help would be appreciated.

Thank you

If I go with the button select a how can I do it on multiple pages?

Use of cookies.

http://www.dynamicdrive.com/dynamicindex9/stylesheetswitcher.htm

Nancy O.
ALT-Web Design & Publishing
Web | Graphics | Print | Media specialists
http://ALT-Web.com/
http://Twitter.com/ALTWEB
http://ALT-Web.blogspot.com

Tags: Dreamweaver

Similar Questions

  • Please help the issue

    I am new to FW and decide. I tried to get all the info of tutorials and help I could. I'm still confused. I am producing a model of Web site page multi with FW exporting CSS and Images.

    I submitted two other crossings with 0 replies. I guess that my questions were too broad? I did some trial and error and tried testing with a simplified version of the model of the multi page site that I am producing. See simplified here:

    http://www.openrangeimaging.com/test-posts/slicetest01.PNG

    The upper area would be the header. The bottom bar will have some nav tabs. The circle must be a logo which if clicked on will take the user to the home page... Below value nav bar is two columns with the content.

    I've tried different ways of slicing cela but cannot get the file to correctly export as CSS and Images. I also can't seem to include the logo as a slice with a link without having the problem of "overlap". I have beaten myself against that for some time and have had no success. Any help or advice on where to get help or an answer at all will be most appreciated. Thank you!

    Great, my message as a whole was wiped out. Here it is again:

    My comments are in line.

    14-10 - 2010 at 02:16, markf12 wrote:

    Jim, thank you very much for your very helpful answer!

    Honestly, I try even to directly export this FW design to a CSS based formatting. I think I would spend much more quickly by exporting FW graphics and design development in DW.

    That's what I needed to know. Being new FW I'm wrong assuming that I could use the Images and CSS to export a clicklable model which could serve as a basic html/css site 15 page I design. I thought it was possible, if only I could figure out how. I expect that a pretty involved job in Dreamweaver would be necessary. Now I understand that for what I'm using the HTML code and Images of the practice is what should be used. Then I develop the site in Dreamweaver using the perhaps some images exported from the model of the FW, but no html or css. Thanks for clearing that for me! I knew I had a fundamental misunderstanding / kernel. Export of Images and CSS is only for a very simple design.

    JB - it IS possible, but you need to design the site according to certain practices. The slices overlap is something to avoid.

    . If you are new to Fireworks, you really want to keep things simple, you will learn the process. Nevertheless, a good knowledge of HTML and CSS is very important.

    Yes, I like to keep things simple, but it's a bit of a trial by fire (pun intended) on a project. I got books and other html and css tutorial type stuff. I wouldn't say my knowledge of this solid as I am new to it. I think that most it and I am determined to become proficient. The only real way to do that is to create something of real / have to start somewhere so...

    JB - get the 'essential' is not enough. If you do not have a strong background in HTML and CSS, you will probably run trouble even IF you export successfully design, because you will have to edit and modify the code once you're in DW. I would recommend your first construction sites "the old-fashioned way" first, before trying to automate the process.

    David Hogue has created a great series of videos of export CSS on the Dev Center of fireworks. I highly recommend watching. Similarly, Michel Bozgounov wrote a great article on creating a Fireworks document for export CSS:

    I had seen a number of tutorials from Dave H. I have somehow forgotten those you provided a link to. I'm watching right now. I had read the Article of Michel B. also excellent. I also read your excellent tutorials and watched your lynda.com training video. I got allot of things.

    Thanks again for your help!

    JB - you are the very welcome. Good luck.

  • How can I help the Uzbek language translation of Mozilla FireFox (Web browser)?

    How can I help the Uzbek language translation of Mozilla FireFox (Web browser)?

    Hi Erkin Farxodovich,
    I thank you for volunteering, to do this please contact the l10n team. And also the location on this page Quick Start Guide: https://wiki.mozilla.org/L10n:Starting_a_localization

    That should have all the information. Please reach out to the group mail as well and they can help with questions along the way.

    I hope this helps.

  • HI PLZ I WANT TO HELP THE UPGRADE TO SSD ODNT WILL I KNOW IF MY BOARD OF DIRECTORS AND THE CPU SUPPORTS

    HI PLZ I WANT TO HELP THE UPGRADE TO SSD ODNT WILL I KNOW IF MY BOARD OF DIRECTORS AND THE CPU SUPPORTS

    MODEL

    Compaq Presario CQ42-372TU computer laptop

    http://h20566.www2.HP.com/portal/site/hpsc/template.page/public/KB/docDisplay/?javax.portlet.begCac=...

    PLZ ANY BODY HELP ME

    You can upgrade to an SSD.

    The simplest method is to use an SSD as the Corsair Force 3 and don't forget that you buy the kit of migration.

    The migration kit comes with cloning software and a usb to SATA power cable that connects again SSD.

    It is recommended that you purchase and SSD that is approximately 256 GB in quality if you can find one that is affordable.

    SSD with migration in a kit options search I did.

  • I received an error code 800b0100 update. I just installed windows 7 student disc and my computer guard stop. I me trying to get the updates that might help the closing of the bottom.

    I received an error code 800b0100 update. I just installed windows 7 student disc and my computer guard stop. I me trying to get the updates that might help the closing of the bottom.

    Hi Happyrockgeek,

    Welcome to Microsoft Windows 7 answers Forum!

    This problem occurs if the Windows security .dll files are incorrectly registered.

    To resolve this problem, you can perform the two methods of troubleshooting, check if the problem is resolved.
    Method 1:
    Run (Checksur.exe) system update readiness tool.
    To do this, follow these steps:
    1. download and run the system update readiness tool. This tool runs an ad hoc analysis of inconsistencies that might prevent future maintenance operations. For more information about how to download and run the Checksur.exe tool, click on the number below to view the article in the Microsoft Knowledge Base:
    http://support.Microsoft.com/default.aspx/KB/947821
    2. try to install the updates again.
     
    Methods 2.
    Reset the Windows Update components.
    1. to reset the Windows Update components automatically, click the fix button in the link below.
    http://support.Microsoft.com/kb/971058 
    2. click run in the file download dialog box and follow the steps described in the fix it Wizard.

    I also suggest you to install the latest version of Windows Installer 4.5.
    Follow the link below to download:
    http://www.Microsoft.com/downloads/details.aspx?FamilyId=5A58B56F-60B6-4412-95B9-54D056D6F9F4&displaylang=en
    and you can also try to install after you turn off the firewall.
     
     
    It will be useful.
     
    Thank you, and in what concerns:
    Shekhar S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum.

  • Why all of a sudden my monitor shows a double image of everything? I checked all the controls in the monitor. Have complete scan of the system. Restarted. Help please!

    Why my monitor see suddenly double images? A bit like a 3D cube. I checked all the settings in the screen itself. They are very good. A comprehensive security system has to analyze. He came clean. Cache of cookies. Defragmented. Restarted. Is entered in controls and found nothing out of the ordinary. But then again, I'm not very savvy computer. Help, please!

    Borrow a monitor from a friend and attach it to your computer, if possible, attach your monitor to your friend's computer.  If the monitor remains screwey computer your friend then the monitor is dying and needs to be replaced.  If the monitor of your friend looks like screwey on your computer, you'll have a hardware problem that must be solved.

  • Helps the KB981852 update

    helps the KB981852 update.  the following message was published in regedit: %Windir%\KB981852.log
     
    [KB981852.log]
    8.767: ================================================================================
    8.767: 2010-11-13 22:43:22.430 (local)
    8.767: c:\690c14c58cb8e8f058d1\update\update.exe (version 6.3.13.0)
    8.783: DoInstallation: GetProcAddress (InitializeCustomizationDLL) returned: 0x7f
    8.783: hotfix started with following command line:
    8,845: CheckSystem: main Version mismatch: STATUS_NT_VERSION_MISMATCH
    8,845: DoInstallation: CheckSystem failed: 0xf021
    8,845: the version of Windows you have installed does not match the update you are trying to install.
    14.602: message displayed to the user: the version of Windows you have installed does not match the update you are trying to install.
    14.602: user input: OK
    14.602: Update.exe extended error code = 0xf021
    14.602: Update.exe return code was masked to 0 x 643 for MSI custom action compliance.

    I am running windows vista with Service Pack 2 installed.

    If you need more info please let me know

    The repeated failures to install KB981852 suggest very strongly that you see the effects of a rootkit infection W32/Alureon-Variant!

    Following the instructions on this site should help you:

    http://www.bleepingcomputer.com/virus-removal/remove-TDSS-tdl3-Alureon-rootkit-using-TDSSKiller>

    ~ or ~.

    Visit the Microsoft Solution Center and antivirus security for resources and tools to keep your PC safe and healthy.  If you have problems with the installation of the update itself, visit the Microsoft Update Support for resources and tools to keep your PC updated with the latest updates.

    Buying to meet problems installing Microsoft security updates also can visit the following page for assistance:https://consumersecuritysupport.microsoft.com/>

    For more information about how to contact your local Microsoft subsidiary for security update support issues, visit the International Support Web site:http://support.microsoft.com/common/international.aspx>

    For enterprise customers, support for security updates is available through your usual support contacts.

  • Help! Aspire 5735 laptop with broken screen does not recognize external monitor after the factory restore

    I have an ACER Aspire 5735, running horrible Vista that never worked from the beginning, always locked up, media player never worked, on, on, and after about a year my dog took in the power cord and threw out of the table and the broken screen. I used it with an external monitor for a while, but it was even worse after that and after that he take to get fixed yet has proceeded to run super slow, always locked up, refused to stop or start upward normally, and so he sat in a closet for about 3 years.

    I took it out a week ago to see if I could at least use it for my kids to friends to play on, but that she still had so many questions, I decided to do a factory restore. And of course the recovery disks that I did when I got it do not work and are not yet recognized by the computer. So I went online and has used a method that I found there by rebooting and hitting the keys ALT F10 until I was at the factory reset option. It worked GREAT! Except once the computer has restarted and opened up to windows deleted monitor and I can't do anything with the computer because apparently it does not recognize that it is hooked to an external monitor on the restore to factory settings! Help!

    She does not recognize the monitor as it has been restarted and was even the windows start the display of the icon, but as soon as it loads the screen becomes black with just the graphics "monitor is on but not connected to what either" floating around.

    Is it possible to access something in the BACK or other so he could recognize the external monitor?  What is finally toast?

    Connect the external monitor to the laptop.

    Hold down the FN key and press the F4 key. Check if you get a display on the external monitor.

  • I have a Compaq W17q monitor. The menu for the monitor keeps appearing on the screen and I can't turn it off. Can someone help with this problem?

    The menu for the monitor screen keeps popping up on my screen and I can't remove it with the menu button.  Help, please.  It interferes with the work on the computer.

    Contact Compaq support.

  • How to help the user focus

    How to help the user focus

    Magnifier enlarges part of the screen. This is especially useful for viewing objects that are difficult to see. It is also useful for people who are generally difficult to see the screen.

  • Program path: c:\windows\system32\audiodg.exe, HELP the cpu at least 99%

    Program path: c:\windows\system32\audiodg.exe, HELP the cpu at least 99%

    Hello

    Method 1: I suggest you put the computer to boot is a way to determine what's asked the origin of the problem:

    http://support.Microsoft.com/kb/929135

    Note: after a repair, be sure to configure the computer to start as usual as mentioned in step 7 in the above article.

    Method 2: You can also try the steps in the link and check if it helps:

    A problem with leaks memory occurs in the Audiodg.exe process when you play audio on a computer that is running Windows 7, Windows Server 2008 R2, Windows Vista or Windows Server 2008

    http://support.Microsoft.com/kb/981013

    Important

    This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs.

    http://Windows.Microsoft.com/en-us/Windows7/back-up-the-registry

  • Elderly person needs help with the monitor goes blank.

    Just bought new computer Tower (PowerSpec) & monitor (Samsung). Monitor turns off after a few seconds and I have to unplug the monitor and plug - then everything is OK.  MFG. says that it is a bug in Windows 7. To eliminate the problem, they put all of my faults forever extinguished.  For me, this is unacceptable.  I tried to install driver but no change.  I tried the old monitor and everything works fine. Why have sleep and hybernation if I need to unplug it manually each time.  Is this a bug or is the problem of the screen?  Do I need to exchange the new monitor?

    If your old monitor works fine and it's new material, I'd bring it back and Exchange. Brand new is not tested

    I hope this helps.

  • In Muse miniature slideshow container, I have images where data in image properties can be set. SEO search engines see the data and help the visibility of my site?

    In Muse miniature slideshow container, I have images where I can insert the data of image properties. SEO search engines see the data and help the visibility of my site?

    Post edited by: Howard Lower and rewrote the question because I have yet to get a response.

    Yes, they will be included in the report.

    Please check these links:

    https://helpx.Adobe.com/Muse/how-to/add-alt-text-and-ToolTips.html

    https://forums.Adobe.com/thread/1747973?start=0&TSTART=0

    Thank you

    Sanjit

  • Help the moderator please

    Help the moderator please delete a post...

    OK, it has now disappeared.

  • calibration of the monitor double u2713h... need help with the same look on the two

    bought the 2 monitors at the same time and just installed the software from dell.com and calibrated to both of them using the i1 display pro.  used in step by step instructions on photographylife.com and it seemed to do what it was supposed to.  picked native and 120 in the first step for the two, crossed the two monitors and save profiles on each cal1 named 'left' and 'right '.

    However the monitors alike.  the image of my right is slightly warmer and brighter.  How can I get it so that both monitors are similar?  should I do the advanced calibration?

    TIA

    DEVELOPMENT expenses calculated that lut3d is not so precise about white point. White point DCCS target drift is an old question, it goes the same for grey neutrality. It is a software problem that Dell (& Xrite) are not willing to fix. Run a check with ArgyllCMS/DisplayCAL for each screen test, then you will see how different are the white dots.

    Order IR to match 'white' for your Dells, your best choice is to use calibration LUT of graphics card. Ned to do this properly, you can:

    -a Quadro or ATI/AMD graphics card. If you do not have one, you don't get the strips, no mater what monitor you have. So if you have an iGPU intel or a nvidia Geforce... Sorry for you.

    -a calibration & profiling software that makes use of a good spectral correction for GB - LED. Spectral correction of XRite for GB-LEDs is called 'RG_phosphor '. For example: i1Profiler or ArgyllCMS/DisplayCAL (v2.6 or v3.1, the latest is less functional, too mandatory 'clicks' to do the same thing)

    The easiest way is to do the calibration in "custom color" OSD mode which gives you access to RGB win & offset controls for each monitor.

    Uniformity cannot be resolved. This way you can get a 'better' white screen central match point (where you place the colorimeter) but if you have a more red/green shift on the left side of the screen, it may seem as if no white screens don't match not if seen next to each other.

Maybe you are looking for