Web Analytics Made Easy -
StatCounter IMG question - CodingForum

Announcement

Collapse
No announcement yet.

IMG question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • IMG question

    Hi I would like to freeze an image other than the background image. How can I keep images locked in place while the rest of the page scrolls?

    Thanks
    Joe

  • #2
    Well Internet Explorer doesn't understand position:fixed; so you could do something like
    Code:
    <style type="text/css">
    #the-image {
    position:fixed; /*for browsers that understand position:fixed;*/
    }
    * html #the-image {
    position:relative;
    top:expression(this.offsetParent.scrollTop - 2); /*for MS IE, that understands expressions but not position:fixed; ironic isn't it*/
    }
    </style>
    That would go in your head tags, and your image that you want to be fixed would look something like this
    Code:
    <img src="blah.jpg" id="the-image" alt="">
    ||||If you are getting paid to do a job, don't ask for help on it!||||

    Comment


    • #3
      Thanks.

      Can I use that multiple times as long as the #the-image is given a different name?

      Joe

      Comment


      • #4
        You should be able to, I haven't worked expressions much.
        ||||If you are getting paid to do a job, don't ask for help on it!||||

        Comment


        • #5
          Yes you can use that but you could better use a class then, so you don't have to make a new css definition in your css.
          Code:
          <style type="text/css">
          .fixedimage {
          position:fixed; /*for browsers that understand position:fixed;*/
          }
          * html .fixedimage {
          position:relative;
          top:expression(this.offsetParent.scrollTop - 2); /*for MS IE, that understands expressions but not position:fixed; ironic isn't it*/
          }
          </style>
          Code:
          <img src="blah.jpg" class="fixedimage" alt="">
          Why the funny - 2 by the way?
          CATdude about IE6: "All your box-model are belong to us"

          Comment


          • #6
            I was just giving an example.
            ||||If you are getting paid to do a job, don't ask for help on it!||||

            Comment


            • #7
              Ok that works fine but I think I asked the wrong question...how can I put a scroll bar only on my table?

              My graphics have a transpatent back ground and the table shows through some of them.

              Thanks

              Joe

              Comment

              Working...
              X