Diferent background image depending resolution of visitor


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script language="JavaScript">
  2.  
  3. if (screen.width + "x" +screen.height == "800x600") document.body.style.backgroundImage = "url(templates/ja_topaz/images/bk7.jpg)";
  4. if (screen.width + "x" +screen.height == "1024x768") document.body.style.backgroundImage = "url(templates/ja_topaz/images/bk6.jpg)";
  5. if (screen.width + "x" +screen.height == "1280x1024") document.body.style.backgroundImage = "url(templates/ja_topaz/images/bk5.jpg)";
  6. if (screen.width + "x" +screen.height == "1600x1200") document.body.style.backgroundImage = "url(templates/ja_topaz/images/bk3.jpg)";
  7. if (screen.width + "x" +screen.height == "1680x1050") document.body.style.backgroundImage = "url(templates/ja_topaz/images/bk2.jpg)";
  8. if (screen.width + "x" +screen.height == "1440x900") document.body.style.backgroundImage = "url(templates/ja_topaz/images/bk.jpg)";
  9. if (screen.width + "x" +screen.height == "1920x1080") document.body.style.backgroundImage = "url(templates/ja_topaz/images/bk8.jpg)";
  10.  
  11. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.