采用:target来实现锚点的动画

  本代码片段来自gruntjs的官方文档:

   比如: http://gruntjs.com/configuring-tasks#files

  

<a class="anchor" href="#files" name="files">Files</a>
@keyframes 'blink'{
   0%{opacity:1.0}
   50%{opacity:.0}
   100%{opacity:1.0}
}

@-webkit-keyframes 'blink'{
   0%{opacity:1.0}
   50%{opacity:.0}
   100%{opacity:1.0}
}

   

a.anchor:target {
    -webkit-animation-name: blink;
    -webkit-animation-direction: normal;
    -webkit-animation-duration: .5s;
    -webkit-animation-iteration-count: 2;
    -webkit-animation-timing-function: ease;
    animation-name: blink;
    animation-direction: normal;
    animation-duration: .5s;
    animation-iteration-count: 2;
    animation-timing-function: ease;
}

相关推荐