所以当我将鼠标悬停在“#header”上时,此代码移动“.now”上升20px,然后当我将鼠标悬停时将其移回。
$(document).ready(function() {
$('#header')
.hover(function() {
$(".now").stop().animate({ top: -20 }, 'fast');
}, function() {
$(".now").stop().animate({ top: 0 }, 'fast');
});
});
如何通过说45度旋转“.now”并移动它?
答案 0 :(得分:0)
旋转元素是基于CSS3样式构建的,在各种现代浏览器中处理不同......
因此,虽然有一些方法可以在没有插件的情况下完成,但使用像jQuery Transit这样的优秀jQuery插件有助于简化实现所需效果所需的代码(就像jQuery本身一样。)