東西:
<div style="position:relative;margin:0 auto;display:block;width:150px;height:150px;overflow:hidden;">
<div style="position:absolute;top:0px;left:0px;border-radius:50px;background-color:red;width:150px;height:150px;">
<div style="position:absolute;top:0px;left:0px;" id="grainybackground"><img src="mygrainybackground.png"></div>
<div style="position:absolute;top:0px;left:0px;"><img src="my_transparant_great_looking borderimage.png" width="150" height="150">
</div>
然後是JavaScript的:
document.getElementById("grainybackground").style.top = "-1px";
上的jsfiddle完成democode:http://jsfiddle.net/tLJgC/:
<div style="position:relative;margin:0 auto;display:block;width:156px;height:156px;overflow:hidden;">
<div style="position:absolute;top:3px;left:3px;border-radius:50%;background-color:red;width:150px;height:150px;">
<div style="position:absolute;top:0px;left:0px;background-color:grey;width:150px;height:150px;" id="grainybackground"><img src="mygrainybackground.png"></div>
<div style="position:absolute;top:0px;left:0px;border:3px solid black;border-radius:50%;width:147px;height:147px;"><!-- ingnore the border, didn't bother looking for aninside transparent bottlecap background image --><img src="my_transparant_great_looking borderimage.png" width="150" height="150">
</div>
和JavaScript
for(c=0;c<150;c++)
{
window.setTimeout("document.getElementById('grainybackground').style.top=-(0+"+c+")+'px';console.log(0-c)",(100*c));
}
第二的jsfiddle與更新的信息
http://jsfiddle.net/tLJgC/2/
<body background="http://hostmypicture.com/images/fundokairo.png">
<div style="position:relative;margin:0 auto;display:block;width:156px;height:156px;overflow:hidden">
<div style="position:absolute;top:3px;left:3px;border-radius:50%;background-color:red;width:150px;height:150px;">
<div style="position:absolute;top:3px;left:3px;width:150px;height:150px;background-image:url('http://hostmypicture.com/images/fundokairo.png');" id="grainybackground"></div>
<div style="position:absolute;top:0px;left:0px;width:150px;height:150px;"><img src="http://s23.postimg.org/mtc0673xj/mascara_Kairos.png" width="150" height="150">
</div>
和JavaScript
for(c=0;c<150;c++)
{
window.setTimeout("document.getElementById('grainybackground').style.top=-(0+"+c+")+'px';document.getElementById('grainybackground').style.backgroundPosition = '"+c+"px "+c+"px'",(100*c));
}
怎麼樣的HTML? –
小提琴在哪裏 – 2013-07-18 11:28:28
這裏是: http://jsfiddle.net/9EFdF/20/ – MEM