Background-image on higher resolutions! No Bg on 800x600

Discussion in 'HTML & Website Design' started by sucka, Aug 23, 2006.

  1. #1
    Hello,

    I´ve got a lil problem with my site. I tried to make it compatible with any resolution, also with 800x600. But I don´t want the background-image, which I have on higher resolutions, in 800x600.

    I want to completely remove the bg image in 800x600.

    Is that possible?

    Thanks
     
    sucka, Aug 23, 2006 IP
  2. sometemple

    sometemple Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I know there's a way to do it using php, but I'm not sure about regular html. Do a little poking around and I'm sure something will come up.
     
    sometemple, Aug 23, 2006 IP
  3. JEET

    JEET Notable Member

    Messages:
    3,832
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #3
    Javascript can detect screen resolution. So here's what you need to do.
    Use java to get screen resolution, store in a variable.
    Now again using java run an IF command and DOCUMENT.WRITE the body tag
    ------------
    <script language="javascript">
    var myname=screen.width;
    if (myname > 800)
    {
    document.write("<body background='backimage.gif'>");
    }
    else
    {
    document.write("<body>");
    }
    </script>

    Change the name of the image to the one you are using. "backimage.gif"
    Then replace your "<body>" tag with this code. :)
    bye :D
     
    JEET, Aug 23, 2006 IP
  4. sucka

    sucka Well-Known Member

    Messages:
    298
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #4

    Hy,

    thank you very much. But what do you mean by "replace your "<body>" tag with this code"?

    Thanks
     
    sucka, Aug 24, 2006 IP
  5. Locovich

    Locovich Peon

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You can also try seting the bkgnd image dinamically, and only for high resolutions...

    <script language="javascript">
    var myname=screen.width;
    if (myname > 800)
    {
    document.body.background='http://www.yourdomain.com/theimg.jpg';
    }
    else
    {
    document.body.background='';
    }
    </script>

    This way you don't need to change anything, just add this code somewhere in the page.
     
    Locovich, Aug 24, 2006 IP
  6. sucka

    sucka Well-Known Member

    Messages:
    298
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #6
    Thank you very much
     
    sucka, Aug 24, 2006 IP
  7. supriyadisw

    supriyadisw Peon

    Messages:
    203
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks for the tutorial. Have a great day...
     
    supriyadisw, Aug 26, 2006 IP