【发布时间】:2016-09-15 02:25:02
【问题描述】:
我尝试制作像这样的简单徽标动画see。每当我转动鼠标来制作这样的动画时。我尝试过但缺少一些东西。请各位大神指导一下。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="jquery-1.8.3.js"></script>
<script>
var mywindow = $(window);
var mypos = mywindow.scrollTop();
var up = false;
var newscroll;
mywindow.scroll(function () {
newscroll = mywindow.scrollTop();
if (newscroll > mypos && !up) {
$('.b').stop().slideToggle();
up = !up;
console.log(up);
} else if(newscroll < mypos && up) {
$('.b').stop().slideToggle();
up = !up;
}
mypos = newscroll;
});
</script>
<style>
body {
height: 1000px;
}
.main {
height: 280px;
width: 100%;
background-color:#000;
position:fixed;
}
</style>
</head>
<body>
<div class="main">
<div class="logo">
<img src="qq.png" class="b" style="display: inline-block;margin-left: 85px;margin-top: 62px;">
</div>
<div class="name">
<img src="eeeee.png" class="c" style="display: inline-block;margin-left: 23px;margin-top: -60px;">
</div>
</div>
</body>
</html>
上面这个工作,但缺少一些平滑度。如果有任何其他方法可以制作这样的动画。
【问题讨论】:
标签: javascript jquery css jquery-animate