我想为网站创建一个CSS或JS动画.但我不知道如何编写代码.动画很难解释,这就是为什么我创建一个小gif动画以便更好地理解.
http://abload.de/img/animationxep49.gif
//编辑:我的主要问题是从白色到黑色的过渡,我在示例中说明了这一点.有人知道解决方案吗?
这是我没有动画的代码:
/* Responsive Navigation */
$(document).ready(function(){
$('#toggle').on('click', function(e){
e.preventDefault();
$('nav ul').slideToggle();
});
});
$(window).on('resize', function () {
if (window.matchMedia('(min-width: 860px)').matches) {
$('nav ul').show();
}
else {
$('nav ul').hide();
}
});
Run Code Online (Sandbox Code Playgroud)
/* Allgemeines */
html, body {
margin: 0px;
padding: 0px;
color: #0a0a0a;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
height: 100%;
}
h1, h2, h3, h4, h5, h6{
font-family: 'Playfair Display', serif;
font-weight: 400;
}
h1 {
font-size: 100px;
font-size: 7.14rem;
text-align: center;
line-height: 1.2;
}
a { …Run Code Online (Sandbox Code Playgroud)