FireFox 3.5重复获取图像精灵-如何防止? [英] FireFox 3.5 Fetches Image Sprite Repetitively - how to prevent?

查看:94
本文介绍了FireFox 3.5重复获取图像精灵-如何防止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mozilla修复了该错误.该线程已死.

这是一个Mozilla错误.查看此线程: https://bugzilla.mozilla.org/show_bug.cgi?id= 501853

This is a Mozilla bug. See this thread: https://bugzilla.mozilla.org/show_bug.cgi?id=501853

我有一个用于图片的精灵: http://www. Trailbehind.com/site_media/images/sprite.png

I have a sprite I use for my images here: http://www.trailbehind.com/site_media/images/sprite.png

在FireFox 3.5中,每次我在地图上渲染图标时,精灵都会被获取,在加载此页面和/或平移地图时,您可以在Firebug网络面板中看到其行为: http://www.trailbehind.com/node/1148091/

In FireFox 3.5, the sprite seems to get fetched every time I render an icon on my map, you can see the behavior in the Firebug Net Panel when you load this page and/or pan the map: http://www.trailbehind.com/node/1148091/

我以前在Internet Explorer中也遇到过类似的问题,但最终在Safari 3/4,FF 2/3和IE 6/7/8中都可以使用.现在,FF 3.5出了点问题:(

I had previously had similar problems to this in Internet Explorer, but I had eventually gotten this working in Safari 3/4, FF 2/3, and IE 6/7/8. Now, something is wrong in FF 3.5 :(

我试图将这段代码放在文档的中以对图像进行预缓存,但无济于事:

I tried to put this code in the of the document to prec-cache the image, but to no avail:

  var pre = new Image();
  pre.src = "/site_media/images/sprite.png"; 

这是稍后创建地图标记的代码(并再次获取精灵图像).可能与GMaps有关-似乎没有获取精灵来在左侧绘制每个图标或其他图像……只是地图.

Here's the code that later creates the map markers (and fetches the sprite image again). It might be GMaps related - it doesn't seem to fetch a sprite to draw each icon or otheer image on the left... just the map.

//returns an image-like GIcon based on a sprite  
function getGIconSprite(attr) {
  var myicon = new GIcon(G_DEFAULT_ICON);
  myicon.sprite = {image:"/site_media/images/sprite.png", top:0};
  myicon.iconSize = new GSize(16,16);
  myicon.iconAnchor = new GPoint(8,8);
  myicon.shadow = null;
  myicon.sprite.left = attr.offset*16;
  return myicon;
}

推荐答案

这是官方 FireFox 3.5错误.它的简单技巧是为所有被剪切的对象创建两个类:一个对所有具有背景图像的对象都是通用的,第二个对具有背景位置的对象是通用的. 就是所有的孩子!)

This is official FireFox 3.5 bug. Simple hack for it is to create two class for all snipped object: one common for all with background image, and the second one with background position. That's all kids!)

这篇关于FireFox 3.5重复获取图像精灵-如何防止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆