寻找 Fireworks“交换图像”的 jQuery 版本
从 Fireworks 转向 jQuery 方式,需要实现 FW 所谓的“交换图像”行为的 jQuery 版本。我还看到过“脱节翻转”这个术语。该版本不是简单地更改已激活锚点的图像源,还将交换未连接到当前/激活锚点的其他“切片”(图像)的源。
Moving into the jQuery Way from Fireworks and need to implement jQuery's version of what FW calls a 'Swap Image' behavior. I've also seen the term 'Disjointed Rollover' used. Instead of a simply changing the image source of the activated anchor this version will also swap the source of other 'slices' (images) not connected to the current/activated one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一个教程就是为了这个目的。通过在 Google 中输入“jQuery disjointed rollover”即可找到。
Here's a tutorial just for that. Found by entering "jQuery disjointed rollover" in Google.
我假设您会使用类选择器通过悬停方法来执行此操作。当您将鼠标悬停在集合上时,会将集合中每个元素的 src 属性替换为图像的“悬停”版本。我使用图像在集合中的相对位置来区分名称,但我想您可以保留名称数组或使用其他确定性算法。
超文本标记语言
I assume that you'd do this with a hover method using a class selector. When you hover over the collection, you replace the src attribute of each element in the set with the "hover" version of the image. I'm using the relative location of the image in the set to distinguish the names, but I suppose you could keep an array of names or use some other deterministic algorithm.
HTML
您只需将这些图像添加到
hover
事件处理程序中即可:我会给所有图像名称提供类似“slice-1.png”的名称和 id“slice-1”这样的内容您可以使用一个函数,该函数不会一一对应,而是挂钩到 id 以“slice”开头的所有图像,然后将所有图像的 src 替换为“otherslice-1”或您拥有的其他内容。
You would simply need to add whatever those images are to the
hover
event handler:I would give all of the image names something like "slice-1.png" and the id "slice-1" so that you could go with a function that didn't go one by one but just hooked into all images with an id starting with "slice" and then replaces the src to all of them to say "otherslice-1" or what have you.