jquery 图像调整大小转换 onMouseOver
只是想知道是否有任何 jquery 插件,当你的鼠标悬停在图像上时,该图像的大小会增加,如果你的鼠标移出图像,它的大小会减小,所有这些都是平滑过渡。 谢谢!
just wondering if there is any jquery plugin that when your mouse is over an image, this image will increase in size and if your mouse is out of the image it'll decrease in size all this as a smooth transition.
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以尝试 Zoomer 画廊插件,或基于 本教程。就我个人而言,我会选择教程路线,因为它可以让您更好地控制结果(并且您将学到一些东西来引导;)
You could try the Zoomer gallery plugin, or roll your own based on this tutorial. Personally I would go the tutorial route since it'll give you more control over the result (and you'll learn something to boot ;)
如果您只想要一张图像,您可以使用 jQuery 的 UI 效果。请注意,这与基本 jQuery 是分开的 - 将其添加到您的 jQuery 调用下方。
现在您已经添加了 UI 的链接,我们可以像这样使用它的效果库:
script:
html:
请记住,当您放大某些内容时,您需要弄清楚如何缩小,因为新尺寸将为 100% 。在我的代码中,我们将其加倍 (200%),然后将其减少一半 (50%) 以恢复到原始值。请随意调整过渡时间以及您可能需要的任何回调以使其完美。
链接到 jQuery .hover() 和 jQuery UI 效果
If you just want one image you can use jQuery's UI effects. Note this is separate from the base jQuery - add this below your call of jQuery.
Now that you've added a link to the UI we can use its effect library like so:
script:
html:
Just remember that when you scale something up you need to figure out how to scale back down since the new size will be 100%. In my code we double it (200%), then reduce it by half (50%) to get back to the original. Feel free to play with the transition time, and any callbacks you might need to get it perfect.
Link to the jQuery .hover() and to jQuery UI effects
有一个 jQuery hack:
但是您可以使用 CSS 伪类,:hover
两者都可以应用于此示例 HTML
There is a jQuery hack:
But you could use a CSS pseudo-class, :hover
Either could be applied to this sample HTML