We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14796
    • 59 Posts
    Ok, here’s the issue peeps - I’ve created a template using MODx, piece of cake. I publish it then check it out online and for some odd reason some of the images on the page have those broken image link red x’s over-lapping them and are revealing the image alt tags, but only in IE. The weirder thing is that it’s only doing this with some of the images, not all of them. So I’ve compared the img tags of the errored ones to the ones without errors and there’s no difference in syntax. I’ve provided a link to the site if you’d like to see the error happen with your own eyes in all it’s irritating glory. Remember, make sure to test it in IE.
      • 25663 MODX Staff
      • 12,272 Posts
      Looks like you got it all figured out. Nice site, too! smiley
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 4095
        • 372 Posts
        Yea nice site dude.

        The problem is still showing on my IE6, seems to be a file called http://www.247atx.com/x.gif which is missing. When I look for broken links with FF it says its broken, but with 0 broken links. Strange.

        Is the file x.gif in the root directory (the same directory as the index.php)?
          [img]http://www.emanz.ac.nz/assets/images/logo/emanz-icon_16x16.gif[/img] Emergency Management Academy of New Zealand [br] http://www.emanz.ac.nz[br][br]MODx Sandbox Login: sandbox Password: castle [br]
          Admin Sandbox Login: sandbox Password: castle
          • 25663 MODX Staff
          • 12,272 Posts
          Ahhh... that comes from the assets/js/sleight.js file ... which only renders in IE6. You need to add a single-px transparent .gif file named "x.gif" to your site root or you can change the last line of the .js file to reflect the location.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 14796
            • 59 Posts
            Sweet, thanks for all the great feedback everyone! For a temporary solution we commented out the "sleigh.js", which appears to be some sort of IE specific file. But I’m going to experiment with the potential solutions you’ve posed and will repost the reults here. I much rather tap the full potential of MODx without having to comment anything out cool
              • 25663 MODX Staff
              • 12,272 Posts
              sleight.js makes it so that inline (not background image) .png files work with transparency in IE. It’s the only way to get that support in IE until version 7 is released. sleight.js really has nothing to do with MODx, but we included it as a convenience (and probably more because I find myself using it on 9 out of 10 sites truth be known tongue).
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 14796
                • 59 Posts
                I see. Well the odd thing is that I don’t have any transparent .png’s anywhere on the page that the red x’s were showing up on. I have some regular .png files, but none with transparency, so I’m not sure why sleight.js was effecting regular .png’s. Also, I tried the suggestion of making a transparent gif and naming it x.gif to overwrite the default x.gif file, but all that did is replace every image on my page that formely had a red x overlapping it with the transparent gif I made, making all the effected images disappear, not sure why though. Lastly, is the sleight.js the same as the code below? Because I know this script also corrects the IE transparent .png bug. I used it on another site I built and it works beautifully. Again, thanks for your incredibly awesome response time and feedback - I’m MODx’s latest fan laugh

                <!--[if lt IE 7]>
                <script language="JavaScript">
                function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
                {
                   var arVersion = navigator.appVersion.split("MSIE")
                   var version = parseFloat(arVersion[1])
                   if ((version >= 5.5) && (document.body.filters)) 
                   {
                      for(var i=0; i<document.images.length; i++)
                      {
                         var img = document.images[i]
                         var imgName = img.src.toUpperCase()
                         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
                         {
                            var imgID = (img.id) ? "id='" + img.id + "' " : ""
                            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                            var imgStyle = "display:inline-block;" + img.style.cssText 
                            if (img.align == "left") imgStyle = "float:left;" + imgStyle
                            if (img.align == "right") imgStyle = "float:right;" + imgStyle
                            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                            var strNewHTML = "<span " + imgID + imgClass + imgTitle
                            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
                            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
                            img.outerHTML = strNewHTML
                            i = i-1
                         }
                      }
                   }    
                }
                window.attachEvent("onload", correctPNG);
                </script>
                <![endif]-->
                  • 22815
                  • 1,097 Posts
                  It is different code, and somewhat longer.
                  // USAGE:
                  // Add to your template or HTML file by adding <script type="text/javascript" src="assets/js/sleight.js">
                  // to the head of your document or template. Make sure that the transparent GIF file (x.gif) is also
                  // in the same directory as the sleight.js file, or that you update the path to the file on
                  // the last line of the code below.
                  
                  if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
                  	document.writeln('<style type="text/css">img, input.image { visibility:hidden; } </style>');
                  	window.attachEvent("onload", fnLoadPngs);
                  }
                  
                  function fnLoadPngs() {
                  	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
                  	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);
                  
                  	for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
                  		if (itsAllGood && img.src.match(/\.png$/i) != null) {
                  			fnFixPng(img);
                  			img.attachEvent("onpropertychange", fnPropertyChanged);
                  		}
                  		img.style.visibility = "visible";
                  	}
                  
                  	var nl = document.getElementsByTagName("INPUT");
                  	for (var i = nl.length - 1, e = null; (e = nl[i]); i--) {
                  		if (e.className && e.className.match(/\bimage\b/i) != null) {
                  			if (e.src.match(/\.png$/i) != null) {
                  				fnFixPng(e);
                  				e.attachEvent("onpropertychange", fnPropertyChanged);
                  			}
                  			e.style.visibility = "visible";
                  		}
                  	}
                  }
                  
                  function fnPropertyChanged() {
                  	if (window.event.propertyName == "src") {
                  		var el = window.event.srcElement;
                  		if (!el.src.match(/x\.gif$/i)) {
                  			el.filters.item(0).src = el.src;
                  			el.src = "x.gif";
                  		}
                  	}
                  }
                  
                  function dbg(o) {
                  	var s = "";
                  	var i = 0;
                  	for (var p in o) {
                  		s += p + ": " + o[p] + "\n";
                  		if (++i % 10 == 0) {
                  			alert(s);
                  			s = "";
                  		}
                  	}
                  	alert(s);
                  }
                  
                  function fnFixPng(img) {
                  	var src = img.src;
                  	img.style.width = img.width + "px";
                  	img.style.height = img.height + "px";
                  	img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')"
                  	img.src = "assets/js/x.gif";
                  }
                  

                  It is worth pointing out that the .js file has been fixed in the 0.9.5 release to reference an x.gif in assets/js - although whether that works when using fakedirs I do not know. The code quoted above is from a MODx 0.9.5 beta.
                    No, I don&#39;t know what OpenGeek&#39;s saying half the time either.
                    MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
                    Forum: Where to post threads about add-ons | Forum Rules
                    Like MODx? donate (and/or share your resources)
                    Like me? See my Amazon wishlist
                    MODx "Most Promising CMS" - so appropriate!