Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/368.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.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
Javascript 屏幕底部的Jquery动画_Javascript_Jquery_Css_Html - Fatal编程技术网

Javascript 屏幕底部的Jquery动画

Javascript 屏幕底部的Jquery动画,javascript,jquery,css,html,Javascript,Jquery,Css,Html,我试图从左到右,然后从右到左的底部动画图像。这是我正在使用的代码,运行良好 这是最新的 函数moveRight(){ $(“#b”).animate({left:+=300},2000,moveLeft) } 函数moveLeft(){ $(“#b”)。动画({left:-=300},2000,moveRight) } $(文档).ready(函数(){ moveRight(); }); 我希望这个动画在屏幕底部的透明div背景。当我添加这一行时 <div id="animate" st

我试图从左到右,然后从右到左的底部动画图像。这是我正在使用的代码,运行良好

这是最新的

函数moveRight(){
$(“#b”).animate({left:+=300},2000,moveLeft)
}
函数moveLeft(){
$(“#b”)。动画({left:-=300},2000,moveRight)
}
$(文档).ready(函数(){
moveRight();
});
我希望这个动画在屏幕底部的透明div背景。当我添加这一行时

<div id="animate" style="position:fixed; bottom:0px; right: 5px; z-index: 999">

那么动画就不起作用了。在这个问题上有人能帮我吗?提前感谢。

尝试以下内容:

<div id="animate" style="position:fixed; height:100px; bottom:0px; left: 5px; z-index: 999">
<img id="b" src="http://www.web-press.it/folder/servizi_cloud.jpg" id="b" style="position:absolute; top:0px"/>
</div>


检查尝试将
top
属性调整为
calc(70%)
<代码>父元素的70%高度

<div id="animate">
<img id="b" src="http://www.web-press.it/folder/servizi_cloud.jpg" id="b" style="position:absolute; top:calc(70%)"/>
</div>


jshiddle,

只需移除顶部:50px;从您的图像样式,并使用css动画div

#animate{
    position: fixed;
    bottom: 0;
    overflow:hidden;
    left:0;
    right:0;
    height: 100px;
    background: #eee;
}

只需删除父级“animate”div并将图像“bottom”样式设置为“0px”


演示


谢谢,但我希望图像位于屏幕底部,如果我调整页面大小,则图像应保持在底部,背景为透明背景谢谢,但如何制作div背景transparent@user3754676当然只需删除背景:#eee;或者,可以使用rgba()选择所需的透明度的颜色和不透明度
#animate{
    position: fixed;
    bottom: 0;
    overflow:hidden;
    left:0;
    right:0;
    height: 100px;
    background: #eee;
}
<img id="b" src="http://www.web-press.it/folder/servizi_cloud.jpg" id="b" style="position:absolute; bottom:50px"/>