嗨,我希望最初可以看到页面顶部的警报横幅,然后在延迟后向上动画。
之后我希望用户能够向上或向下切换元素。
这是我的html:
$(document).ready( function() {
$('#foo').delay(3000).animate({
top: "-150px",
}, 1000, function() {
// Animation complete.
});
});
$(document).ready(function() {
$('#clickme').toggle(function() {
$('#foo').animate({
top: '-=120'
}, 1000);
},function() {
$('#foo').animate({
top: '+=120'
}, 1000);
})
});
</script>
</head>
<div id="foo">
It's a notification!
</div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas
tortor arcu, sollicitudin et rutrum non, dapibus convallis est. Nulla in
est risus, sit amet consectetur eros. Aliquam posuere, tellus at cursus
pulvinar, mi nulla bibendum sapien, quis lobortis diam risus nec lectus.
Sed justo nunc, lacinia ac sagittis non, aliquam nec est. Praesent porta
neque sed erat vehicula id cursus quam semper.</p>
<button id="clickme">
Click here
</button>