SOLUTION:Fiddle(感謝約西亞)CSS - 運行Android Lollipop點擊並按住背景,風格
UPDATE:Fiddle(感謝GaneshBhosale)
我想要的風格按鈕,以便當用戶徘徊時,它的背景是一個像您在下面的動畫中看到的那樣增長的圓圈。 我做了一些測試,但我沒有任何工作小提琴。 任何人都知道如何做到這一點?
HTML
<figure>
<a href="#">
<img src="http://lorempixum.com/200/200/nature/1" alt="" />
<figcaption class="circle">Oh, la belle image!</figcaption> </a>
</figure>
<figure>
<a href="#">
<img src="http://lorempixum.com/200/200/nature/1" alt="" />
<figcaption class="star">Oh, la belle image!</figcaption> </a>
</figure>
CSS
.circle {
-webkit-clip-path: circle(50%,50%,10%);
clip-path: circle(50%,50%,10%);
}
a:hover .circle,
a:focus .circle {
-webkit-clip-path: circle(50%,50%,75%);
clip-path: circle(50%,50%,75%);
}
.star {
-webkit-clip-path: polygon(50% 38%, 58% 62%, 38% 47%, 62% 47%, 42% 62%);
clip-path: polygon(50% 40%, 58% 60%, 40% 47%, 60% 47%, 42% 60%);
}
a:hover .star,
a:focus .star {
-webkit-clip-path: polygon(50% -100%, 180% 200%, -100% 0%, 200% 0%, -80% 200%);
clip-path: polygon(50% -100%, 180% 200%, -100% 0%, 200% 0%, -80% 200%);
}
figcaption {
position: absolute;
top: 0; bottom: 0; left: 0; right: 0;
transition: -webkit-clip-path .3s;
}
/*cosmetics*/
figure {
position: relative;
display: inline-block;
width: 200px; height: 200px;
margin: 20px;
box-shadow: 0 2px 2px rgba(0,0,0,.5);
}
figcaption {
background: rgba(0,0,0,.8);
color: yellowgreen;
text-align: center;
font-size: 1.4em;
padding-top: 2em;
}
html {
text-align: center;
}
編輯:也可以鏈接,LI項目或DIV
謝謝你,感謝AndroidPolice的GIF !
你還能發佈您的代碼嘗試? – ajp15243 2014-12-03 18:45:00
我基於http://codepen.io/iamvdo/pen/EIjLa,但這有時不起作用,它不動畫。 此外,我想背景有這種效果,而不是前景 – 2014-12-03 18:58:06
我特別喜歡[這個例子](http://codepen.io/dwijitsolutions/pen/myrvJW)。它使用JS,但不是很多。只有創建一個覆蓋層。愛它! – 2015-05-21 17:29:39