本文介绍了使用 jQuery 在悬停/退出时展开/缩小 div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我正在寻找一个 jQuery 插件来扩展 div 元素,以便在悬停时显示它们的溢出(如果有的话).插图:
I am looking for a jQuery plugin to expand div elements so as to reveal their overflow (if any) on hover. Illustration:
插件应该在相对定位的 div 上工作(我猜这意味着您创建 div 的副本,将其定位设置为绝对,然后弄清楚放在哪里).
The plugin should work on relatively positioned div's (which I guess implies that you create a copy of the div, set its positioning to absolute, then figure out where to place it).
是否已经有这样的插件可用?
推荐答案
你不需要插件.只需添加适当的 css 并使用 jQuery animate:
You don't need a plugin. Just add proper css and use jQuery animate:
$div
.on('mouseenter', function(){
$(this).animate({ margin: -10, width: "+=20", height: "+=20" });
})
.on('mouseleave', function(){
$(this).animate({ margin: 0, width: "-=20", height: "-=20" });
})
此处演示
这篇关于使用 jQuery 在悬停/退出时展开/缩小 div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
The End





大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)