We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14779
    • 256 Posts
    I’m trying to set up a quick way to overlay a transparent gif over all images on my site. I saw lots of different sites with lots of different ways, but I was hoping someone here would be able give a the best solution for a modx based site.
    My initial idea was to specify a transparent gif as a background image, and use z-index to raise it above the image i’m trying to protect. That didn’t seem to work. here is the code I used:

    .transparent {
    z-index:1000; 
    background:url(../images/transparent.gif) repeat;
    }


    the gif is 1px

    I added the class="transparent" call to each image tag.
      PM me to find out how you can get a FREE ipad 2!
      • 7231
      • 4,205 Posts
      I don’t have experience to help you but I did just bookmark a promising tutorial on this subject:
      http://blog.adamoliver.net/tutorials/cross-browser-transparent-div-with-opaque-content/
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 14779
        • 256 Posts
        Quote from: dev_cw at Feb 04, 2009, 02:22 PM

        I don’t have experience to help you but I did just bookmark a promising tutorial on this subject:
        http://blog.adamoliver.net/tutorials/cross-browser-transparent-div-with-opaque-content/
        That’s a great tutorial, but I’m looking for info more directly related to overlaying a transparent image over another image. Maybe a plugin or snippet that will do this automatically for all images on the site.
          PM me to find out how you can get a FREE ipad 2!
          • 22840
          • 1,572 Posts
          If your adding that class to the image src link it wont work, as the image will still sit ontop of your Transparent gif, you also havn’t set a height and width for the class.

          try wrapping the image with a div of that class.

          Also there is a bug in ie that doesn’t listen to the z-index unless you position the element either relatevly or absolutey.

          .transparent {
          position: relative;
          width: 100%;
          height: 100%;
          z-index:1000; 
          background:url(../images/transparent.gif) repeat;
          }
            • 30223
            • 1,010 Posts
            That won’t work either because if you raise the div with z-index you automatically raise it’s content as well,... being the image. You need a second div that is positioned on top of the image (either relative or absolute). Something like this perhaps? (I haven’t tried)

            <div>
                <img src="original" width="100" height="100" />
                <div class="transparent"></div>
            </div>
            
            <style blah blah>
               div.transparent {
                  position: relative;
                  top:0px;
                  left:0px;
                  width: 100%;
                  height: 100%;
                  z-index:1000; 
                  background:url(../images/transparent.gif) repeat;
               }
            </style>
              • 22840
              • 1,572 Posts
              rolleyes