[英]js animating block with image inside
Have a block with another relative block inside, which has a background in style of parent block (like on aa picture). 有一个内部有另一个相对块的块,该块具有父块样式的背景(如在图片上)。 When i trying to change width of my block, relative block disappears.
当我尝试更改块的宽度时,相对块消失了。
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style>
#button
{
width: 195px ;
height: 60px;
display: inline-block;
position: relative;
background: url('/res/bg.png') repeat-x;
}
#button div#arrow
{
background: url('/res/Arrow.png') no-repeat;
width: 30px;
height: 60px;
display: block;
position: absolute;
top:0px;
right: -30px;
}
</style>
</head>
<body>
<div id='button'>
<div id='arrow'></div>
</div>
</body>
</html>
Forgot about the code of animating: $('#button').animate({width:'-=120px'}, 2000) 忘记了动画代码:$('#button')。animate({width:'-= 120px'},2000)
Set overflow: visible !important
on the parent div
. 在父
div
上设置overflow: visible !important
。
Demo: http://jsfiddle.net/P5CHX/2/ 演示: http : //jsfiddle.net/P5CHX/2/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.