admin管理员组文章数量:1357121
I want to zoom/unzoom a text with animate. The problem is that the text is absolutely positioned inside a relative div and when I animate the font-size the text expands only to the right and bottom. I want it to expand/retract to all sides equally.
Prepared example:
I want to zoom/unzoom a text with animate. The problem is that the text is absolutely positioned inside a relative div and when I animate the font-size the text expands only to the right and bottom. I want it to expand/retract to all sides equally.
Prepared example: http://jsbin./wele/48103/edit
Share Improve this question asked Nov 13, 2012 at 16:03 Eike CochuEike Cochu 3,4377 gold badges36 silver badges58 bronze badges 3- Does the text have to remain relatively positioned? – Luke Commented Nov 13, 2012 at 16:07
- You need to animate top: and left: along with the resize. – Diodeus - James MacFarlane Commented Nov 13, 2012 at 16:07
- do u need the animation? coz otherwise u could just use plain CSS to increase font sizes on hover in and out – Sajjan Sarkar Commented Nov 13, 2012 at 16:08
2 Answers
Reset to default 5Animate using the CSS transition
property:
.zoom {
display: inline-block; /* this is needed for inline elements */
transition: transform 0.3s ease-in-out;
}
.zoom:hover {
transform: scale(1.4);
}
<a class="zoom" href='#'>Hover me!</a>
The align in horizontal center is easy. Just add text-align: center
and it will work. But if you want to align it in middle, you need to use display: table
, because "only" td is "allowed" to set vertical-align: middle
. So you have to build a div-table layout around: http://jsbin./wele/48145/edit
本文标签: javascriptJQuery zoom text on hoverStack Overflow
版权声明:本文标题:javascript - JQuery: zoom text on hover - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743992169a2572344.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论