简体   繁体   English

动画化网页中的链接

[英]Animate opening of link in webpage

I have a several links in my HTML. 我的HTML中有几个链接。 When a link is clicked, I would like the new page to appear using a fade in/cross-dissolve animation. 单击链接后,我希望使用淡入/交叉溶解动画来显示新页面。 I have read a bit about CSS animations, but not sure if this is achievable. 我已经阅读了一些有关CSS动画的内容,但不确定是否可以实现。 Any help would be appreciated please. 任何帮助将不胜感激。

You can try this (and don't forget to load the styles at the head): 您可以尝试以下操作(不要忘记将样式加载到头部):

html{
    opacity: 1;
    -webkit-transition-property: opacity;
    -webkit-transition-duration: 500ms;
}

html.hide{
    opacity: 0; 
}

the HTML HTML

<html class='hide'>
...
</html>

and the with JS: 和JS:

window.onload = function(){document.getElementsByTagName('html')[0].className = '';}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM