Jquery 和 sIFR 链接管理
好的,我正在使用 Jquery 构建动态菜单,并使用 sIFR 将文本更改为 TrajanPro 字体。
这不混合。不过,我想找到一种方法让它混合起来。
sIFR 具有自动解析链接的功能,以便 Flash 将您引导至链接位置。它不做的是传递 javascript 触发器。我试图通过使用硬链接,然后用 Jquery 重写它们来管理子菜单的可见性,使我的菜单尽可能易于访问,就像这样 ~
(CSS)
.submenu {display: none;}
(Javascript)
$("a#top1").click(function(event){
$(".submenu").css("display","none");
$("#sub1").css("display","block");
event.preventDefault();
});
...对每个顶级菜单链接 ID 重复(#top2、#top3、#top4 - 只有 4 项。)
有谁知道一种简单的方法可以让 sIFR 很好地处理 javascript 触发器,而无需重写核心 sIFR 代码(这几乎超出了我的能力)?
我知道 sIFR 有其他替代方案,例如图像替换,而且我知道你们中的一些人可能会建议它们 - 这很酷,但让我先声明一下我的项目目标:
1)优雅地降级。如果缺少 javascript,链接仍然有效,如果图像/flash 无法加载文本,而不是红色 x 和 alt 标签。
2)很好地扩展。我在所有事情上都使用 ems,我的老板在 Iphone 上查看所有内容,众所周知,我们的客户使用从 IE6 到 Macbooks 到 lynx 浏览器、大屏幕和小屏幕的所有内容。我需要文本“适合”所有情况。
3)如果没有Flash,则必须工作。至少可以正确显示文本。该死的苹果和他们的 iPad...(是的,我知道 sIFR 依赖于闪存,但它有各种技巧可以无缝降级。)
4)页面上没有太多文本或其他任何内容,所以有点代码膨胀是可以的,只要满足前面的要求即可。不过,如果我能保持我的源订单完好无损,那就太好了;按照我现在的方式,在我们开始讨论之前,大约有 10 行代码/标题链接。
万分感谢!!!
Ok, I'm using Jquery to build a dynamic menu, and sIFR to change the text to TrajanPro font.
This does not mix. I want to find a way to make it mix, though.
sIFR has automatic parsing of links, so that Flash sends you to the link location. What it doesn't do is pass on javascript triggers. I'm trying to make my menu as accessible as possible, by using hard links and then rewriting them with Jquery into managing the visibility of submenus, like this ~
(CSS)
.submenu {display: none;}
(Javascript)
$("a#top1").click(function(event){
$(".submenu").css("display","none");
$("#sub1").css("display","block");
event.preventDefault();
});
...repeated for every top level menu link ID (#top2, #top3, #top4 - there are only 4 items.)
Does anyone know an easy way to get sIFR to treat javascript triggers nicely, without rewriting the core sIFR code (which is pretty much beyond my abilities)?
I know there are alternatives to sIFR such as image replacement, and I know some of you will probably suggest them - that's cool, but let me state my project goals up front:
1)degrades gracefully. If javascript is absent, the links still work, if images/flash fail to load the text is there instead of a red x and an alt tag.
2)scales nicely. I'm using ems for everything, and my boss views everything on an Iphone, and our customers are known to use everything from IE6 to Macbooks to lynx browsers, big screens and small. I need the text to 'fit' in all cases.
3)Has to work if Flash is absent. At least display text correctly. Damn Apple and their Ipads... (yes, I know sIFR relies on flash, it's got all kinds of tricks to degrade seamlessly though.)
4) there's not a whole lot of text or anything else on the page, so a bit of code bloat is ok, as long as the previous requirements are met. It'd be nice if I could keep my source order intact, though; the way I've got it now there's like 10 lines of code/header links before we're into the meat.
Thanks a bunch!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
已解决 - Cufón (http://cufon.shoqolate.com/generate/) 是一种字体-完全依赖于 javascript 和 javascriptable 语言(SVG 和 VML)的替代解决方案,从而允许像任何其他元素一样对结果元素进行脚本编写。
岩石!
保留这个问题以防其他人遇到同样的问题。
Solved - Cufón (http://cufon.shoqolate.com/generate/) is a font-replacement solution that relies completely on javascript and javascriptable languages (SVG and VML), thus allowing the resulting element to be scripted like any other.
Rock!
Leaving this question up in case anyone else runs into the same problem.
sIFR 3 有用于此目的的 API,但它需要与您的代码库进行一些集成。
sIFR 3 has APIs for this, but it needs a bit of integration with your code base.