图层更改时的 Z-index 修改(jquery 插件修改)?
我使用以下 jquery 插件新闻旋转器来显示几个不同的新闻标题: http://landofcoder.com/index .php?option=com_jdownloads&Itemid=372&task=view.download&cid=9
相当不错的标题,但它似乎没有修改当您跳转到不同的图层/故事时,z-index 会导致嵌入在第 1 层的视频始终激活,即使我单击其他图层中的新闻故事或视频也是如此。因此,例如,如果我转到另一个故事并单击播放按钮,第一个(最上面)故事上的视频将激活,而不是我正在播放的视频。
我希望有一个示例来说明如何修改脚本以方便在图层/故事更改时也更改 z-index。
我猜测可以在 script.js 文件中不透明度偏移下方的 fxStart 函数中进行修改,但我还没有达到 js 的水平。
I'm using the following jquery plugin news rotator for displaying several different news headlines:
http://landofcoder.com/index.php?option=com_jdownloads&Itemid=372&task=view.download&cid=9
Quite a nice headliner, but it doesn't seem to modify z-index when you jump to different layers / stories and consequently the video that is embedded on layer 1 always activates, even if I click news stories or vides in other layers. So, for example, if I move to another story and click the play button, the video on the 1st (top most) story activates vs the one I'm on.
I was hoping for an example of how to modify the script to facilitate also changing z-index on layer / story change.
I am guessing that the modification could be made in the fxStart
function below the opacity shift within the script.js
file, but I'm just not up to snuff on js yet.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我绕过后面的白屏的方法是仅对当前图层进行动画处理。因此,当您想要淡入下一层时,您可以:
1. 将当前图层的 z-index 设置为较高的数字(例如 3)
2. 将下一层的 z-index 设置为较小的数字(例如 2)并将不透明度设置为 1
3. 仅淡出当前图层,这将显示下面的下一个图层。
4. 在当前图层动画上设置回调函数,将 z 索引重置为正确的值,以免扰乱下一个过渡。
因此,根据我的最后一个建议,我建议:
这有意义吗?
Ok the way I get around the white screen behind is to only animate the current layer. So when you want to fade to the next layer, you:
1. Set the z-index of the current layer to a high number (say 3)
2. Set the z-index of the next layer to a lower number (say 2) and set the opacity to 1
3. Fade out the current layer only and that will reveal the next layer below.
4. Set a callback function on the current layer animation to reset z-indexes to their correct values so as to not mess up the next transition.
so adapting my last suggestion, I would recommend:
Does that make sense?
似乎没有一个网站可以让这个脚本演示或公开 api(似乎没有任何 api),所以这是在黑暗中拍摄......您应该能够用这两行更改第 277 行:
这里的想法是,在动画开始之前,您只需设置视频的正确 zIndex 即可。
同样,这是在黑暗中拍摄的,因为我假设“currentObj”是当前显示的对象,而“$(this.slides).eq(index)”是下面的下一个对象。
There does not seem to be a website for this script to demonstrate or expose the api (doesn't seem to have any api) so this is a shot in the dark ... You should be able to change line 277 with these two lines:
The idea here is that before the animation begins you simply set the correct zIndex of the videos.
Again this is a shot in dark because I'm assuming 'currentObj' is the currently displayed object and '$(this.slides).eq(index)' is the next object underneath.