[英]js animating block with image inside
有一個內部有另一個相對塊的塊,該塊具有父塊樣式的背景(如在圖片上)。 當我嘗試更改塊的寬度時,相對塊消失了。
<!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>
忘記了動畫代碼:$('#button')。animate({width:'-= 120px'},2000)
在父div
上設置overflow: visible !important
。
演示: http : //jsfiddle.net/P5CHX/2/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.