Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当元素移出其容器时,jqueryanimate位于元素下_Jquery_Css_Jquery Animate - Fatal编程技术网

当元素移出其容器时,jqueryanimate位于元素下

当元素移出其容器时,jqueryanimate位于元素下,jquery,css,jquery-animate,Jquery,Css,Jquery Animate,我有一个元素,它位于容器内,位置相对,当我把这个元素移出容器的一侧时,它就消失了。但是我需要在元素从它自己的容器中取出后显示它。那个么,我怎样才能使那个元素在它从它的容器中取出后显示出来呢 <div class="container"> <div class="moving-element"> </div> </div> $(element).animate({"top": "-100px"}, speed, easing, f

我有一个元素,它位于容器内,位置相对,当我把这个元素移出容器的一侧时,它就消失了。但是我需要在元素从它自己的容器中取出后显示它。那个么,我怎样才能使那个元素在它从它的容器中取出后显示出来呢

<div class="container">
    <div class="moving-element">
    </div>
</div>


$(element).animate({"top": "-100px"}, speed, easing, func);

$(元素)。动画({“顶部”:“-100px”},速度,放松,函数);

使用CSS可以设置该元素的z索引

z-index: 999;
将确保它几乎总是在顶部(除非其他元素具有更高的z索引并且重叠)

编辑

实际上,它可能是您的CSS或其他冲突元素,请看:

<style type="text/css">
.container {
height: 500px;
width: 500px;
background: red;
}

.moving-element {
position: relative;
height: 250px;
width: 250px;
background: blue;
}
</style>

<div class="container">
    <div class="moving-element">
    </div>
</div>

<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(function() {
    $('.moving-element').animate({"top": "-100px"}, 1000);
});
</script>

.集装箱{
高度:500px;
宽度:500px;
背景:红色;
}
.移动元素{
位置:相对位置;
高度:250px;
宽度:250px;
背景:蓝色;
}
$(函数(){
$('.moving element').animate({“top”:“-100px”},1000);
});

适合我。

你能发布这两个类的CSS吗?.移动元素{位置:相对;顶部:-400px;左:0px;浮动:左;左边距:20px;宽度:100px;高度:100px;溢出:隐藏;}和容器没有样式