Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

[修改] 解决x2 logo透明问题

[复制链接]
nxitxlf 发表于 2012-3-4 21:00:56 | 显示全部楼层 |阅读模式
本帖最后由 nxitxlf 于 2012-3-4 21:02 编辑

不能透明应该是IE6的一大BUG吧
在论坛搜索了下,解决PNG LOGO透明的方法确实很多。
有PS里面修改PNG 为8的 也有修改24 索引 等等之类的
发现都不能完美解决
比如 PNG8后会有白色描边 PN24白色背景
最佳解决办法:
方法一:
上传tm.js至 static/js/
然后添加其他头部信息:
<script src="/static/js/tm.js" type="text/javascript"></script>
预览:http://hao.freeweb123.com
可能有些用IE6以上的没发现这个问题,但是IE6内核的都会出现这样的问题,而用IE6内核的人群还是很多的。
关于 问题说 要等几秒才能透明背景  那是因为加载JS的速度  刚发现DZ本身就有优化JS的
默认目录 static/js/ 设置站点 JS 文件的目录。当脚本目录为缓存目录时,系统会将默认目录中的 *.js 文件进行压缩然后保存到缓存目录以提高读取速度
记住不能设置logo大小(如logo.png,80,40).设置大小之后会得不到你想要的效果
下载地址二:
  1. http://hao.freeweb123.com/forum.php?mod=viewthread&tid=521&extra=page%3D1
复制代码
方法二:用PS将你的PNG LOGO图片转换成gif格式.万事OK 预览:http://hao.freeweb123.com
方法三:预览:http://hao.freeweb123.com
把下面的代码复制到后台   全局  站点信息  网站第三方统计代码 就ok了

  1. function correctPNG()
  2. {
  3. for(var i=0; i<document.images.length; i++)
  4. {
  5. var img = document.images[i]
  6. var imgName = img.src.toUpperCase()
  7. if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
  8. {
  9. var imgID = (img.id) ? "id='" + img.id + "' " : ""
  10. var imgClass = (img.className) ? "class='" + img.className + "' " : ""
  11. var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
  12. var imgStyle = "display:inline-block;" + img.style.cssText
  13. if (img.align == "left") imgStyle = "float:left;" + imgStyle
  14. if (img.align == "right") imgStyle = "float:right;" + imgStyle
  15. if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
  16. var strNewHTML = "<span " + imgID + imgClass + imgTitle
  17. + " style="" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
  18. + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
  19. + "(src=\'" + img.src + "\', sizingMethod='scale');">"
  20. img.outerHTML = strNewHTML
  21. i = i-1
  22. }
  23. }
  24. }
  25. window.attachEvent("onload", correctPNG);

复制代码
回复

使用道具 举报

marco187 发表于 2012-3-4 22:17:44 | 显示全部楼层
不修改让他们觉得ie6过时自然升级浏览器
回复

使用道具 举报

ac136 发表于 2012-3-4 22:28:34 | 显示全部楼层
直接转成png-8的格式在IE6下就是透明的了
回复

使用道具 举报

pxtxb 发表于 2012-9-22 14:09:38 | 显示全部楼层
ie6真不是一般的烦啊
回复

使用道具 举报

applehi 发表于 2014-1-10 08:58:48 | 显示全部楼层
我想问楼主,为什么官方设计的png图片就可以在ie6下透明
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-11-23 13:29 , Processed in 0.099762 second(s), 15 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表