我在一个元素上有动画,但它的运动也会影响兄弟姐妹。我只能在不影响兄弟姐妹元素的情况下才能在项目上拥有动画?
问题的示例:
function animateSearch() {
$('.glyphicon-search').animate({'margin-top':'-10px'}, 1000);
$('.glyphicon-search').animate({'margin-top':'0px'}, 1000);
}
var interval = setInterval(animateSearch,1000);
$('.arrowDown').mouseover(function() {
clearInterval(interval);
});
演示:jsfiddle
只需将CSS postion:absolue
像Bellow一样放置:
.glyphicon-search {
position:absolute;
}
小提琴