0

How to get a background-color effect when clicking on a url#header4 link

like for instance here on stackoverflow. if you would select this on:

How to shutdown my system via a php site using LAMP server?

That is a link with an id and when u click it you would go to that link, to that header, and get a fancy background affect with a fading effect.

how can i get that effect on my website?

4

1 回答 1

0

您可以使用 CSS 3(动画和关键帧)来实现。根本不需要javascript。

.targetbox:target {
    animation: 2s ease 0s normal none 1 trgt;
}

@keyframes trgt {
    0% { background: #ff3; }
    100% { background: #ffa; }
}

…

看我的小提琴:http: //jsfiddle.net/SCQev/1/

于 2013-09-25T12:33:24.663 回答