鼠标悬停时在轮播顶部设置绝对定位的 div 动画
我有一个简单的轮播实现,我正在尝试对其进行一些调整以匹配一些非常具体的要求。
有一个绝对定位的覆盖层,当页面首次加载时突出显示轮播的第一个缩略图。
当鼠标移至轮播中的另一个可见缩略图时,我需要它滑动到该缩略图,并将叠加层中的文本更新为新图像编号(在 x 幅图像中) )。
现在,我花了将近一整天的时间试图让动画顺利进行。我尝试了多种方法,但我感到非常沮丧。这可能是因为我缺乏 CSS3 忍者能力。
这里是相关 HTML、CSS 和 jQuery 轮播实现的小提琴,需要 slidy- 的工作版本上面描述的四四方方的东西。
I've got a simple carousel implementation which I'm trying to tweak a bit to match some very specific requirements.
There is an absolutely positioned overlay which highlights the first thumbnail of the carousel when the page first loads up.
When the mouse is moved over to another visible thumbnail in the carousel, I need it to slide across to that thumbnail, and update the text within the overlay to the new image number (out of x number of images).
Now, I have spent nearly a full day trying to get the animation to happen nicely. I've tried with multiple approaches, and I'm getting quite frustrated. It is probably due to my lack of CSS3 ninja-ness.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是小提琴的更新版本。
mouseover 事件的代码如下:
需要调整的代码的最后一点是重置轮播的上一个/下一个操作上的叠加层的左侧位置。我没有添加这一点,但这只是将
left
属性动画到其原始偏移量的问题。Here's an updated version of the fiddle. Code is as follows for the
<img>
mouseover event:The last bit of the code that would need to be tweaked is resetting the overlay's left position on the carousel's prev/next actions. I didn't add this bit but it's just a matter of animating the
left
property to its original offset.