影响兄弟姐妹位置的动画
Animation affecting siblings position
我在一个元素上有动画,但它的移动也会影响兄弟姐妹。如何在不影响 siblings 元素的情况下仅在项目上使用动画?
问题示例:
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
规则如下:
.glyphicon-search {
position:absolute;
}
Fiddle Here
我在一个元素上有动画,但它的移动也会影响兄弟姐妹。如何在不影响 siblings 元素的情况下仅在项目上使用动画?
问题示例:
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
规则如下:
.glyphicon-search {
position:absolute;
}
Fiddle Here