Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.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
Jquery 我想用隐藏的子div向左展开div?_Jquery_Html_Css - Fatal编程技术网

Jquery 我想用隐藏的子div向左展开div?

Jquery 我想用隐藏的子div向左展开div?,jquery,html,css,Jquery,Html,Css,我想制作隐藏有子div的边栏div。当滚动父div时,它将展开并显示子div,并在滚动div时折叠回其原始大小。 我希望我的侧边栏与此类似。它的联系侧边栏,我真的想这样 CSS #Sidebar { width: 40px; height: 40px; margin-right: 0px; top: 300px; position: fixed; right: 0px; background-image: url(chat.png);

我想制作隐藏有子div的边栏div。当滚动父div时,它将展开并显示子div,并在滚动div时折叠回其原始大小。 我希望我的侧边栏与此类似。它的联系侧边栏,我真的想这样

CSS

#Sidebar {
    width: 40px;
    height: 40px;
    margin-right: 0px;
    top: 300px;
    position: fixed;
    right: 0px;
    background-image: url(chat.png);
    background-repeat: no-repeat;
    background-size: cover;
    color: #FFF;
    -webkit-transition: all 1s ease 0s;
    -moz-transition: all 1s ease 0s;
    -ms-transition: all 1s ease 0s;
    -o-transition: all 1s ease 0s;
    transition: all 1s ease 0s;
    background-color: #F90;
    }
#Sidebar:hover {
    height: 50px;
    width: 100px;
}
.divchild {
    height: 25px;
    width: 25px;
    background-color: #0F3;
    top: 5px;
    right: 0px;
    margin: auto;
    position: relative;
}
Html

<a href="#">
<div class="Sidbaredges" id="Sidebar">
 <div class="divchild"></div>
 </div>
</a>


函数鼠标悬停()
{
document.getElementById('divchild').style.display='block';
}
函数鼠标_out()
{
document.getElementById('divchild').style.display='none';
}
#边栏{
宽度:40px;
高度:40px;
右边距:0px;
顶部:300px;
位置:固定;
右:0px;
背景图片:url(chat.png);
背景重复:无重复;
背景尺寸:封面;
颜色:#FFF;
-webkit转换:所有1都简化为0;
-moz转换:所有1都是0;
-ms转换:所有1到0;
-o-转换:所有1都是0;
转换:所有1到0;
背景色:#F90;
}
#侧栏:悬停{
高度:50px;
宽度:100px;
}
divchild先生{
高度:25px;
宽度:25px;
背景色:#0F3;
顶部:5px;
右:0px;
保证金:自动;
位置:相对位置;
}
css测试
我也使用javascript。

试试这个

CSS


这把小提琴是正确使用的
css
jquery

查看此演示


这是一项伟大的工作,但为什么在我的浏览器和Dreamweaver上不起作用呢(TypeError:$(…)是未定义的[Break On This Error]$(document)。ready(函数(){在这一行,我的firebub显示了我上面提到的错误。它在我的DreaWaver和任何浏览器中都不起作用。你有没有包括jquery库?像这样…code.jquery.com/jquery latest.js“>$(document)。ready(函数(){…);
<!DOCTYPE HTML>
<head>
<script type="text/javascript">
function mouse_over()
{
    document.getElementById('divchild').style.display = 'block';
}
function mouse_out()
{
    document.getElementById('divchild').style.display = 'none';
}
</script>
<style type="text/css">
#Sidebar {
    width: 40px;
    height: 40px;
    margin-right: 0px;
    top: 300px;
    position: fixed;
    right: 0px;
    background-image: url(chat.png);
    background-repeat: no-repeat;
    background-size: cover;
    color: #FFF;
    -webkit-transition: all 1s ease 0s;
    -moz-transition: all 1s ease 0s;
    -ms-transition: all 1s ease 0s;
    -o-transition: all 1s ease 0s;
    transition: all 1s ease 0s;
    background-color: #F90;
}
#Sidebar:hover {
    height: 50px;
    width: 100px;
}
.divchild {
    height: 25px;
    width: 25px;
    background-color: #0F3;
    top: 5px;
    right: 0px;
    margin: auto;
    position: relative;
}

</style>
<meta charset="UTF-8">
<title>css test</title>
</head>
<body>
<a href="#">
<div class="Sidbaredges" id="Sidebar" onMouseOver="mouse_over();" onMouseOut="mouse_out();">
  <div class="divchild" id="divchild" style="display:none;"></div>
</div>
</a>
</body>
</html>
#Sidebar {
    width: 40px;
    height: 40px;
    margin-right: 0px;
    top: 300px;
    position: fixed;
    right: 0px;
    background-image: url(chat.png);
    background-repeat: no-repeat;
    background-size: cover;
    color: #FFF;
    -webkit-transition: all 1s ease 0s;
    -moz-transition: all 1s ease 0s;
    -ms-transition: all 1s ease 0s;
    -o-transition: all 1s ease 0s;
    transition: all 1s ease 0s;
    background-color: #F90;


}
#Sidebar:hover {
    height: 50px;
    width: 100px;
    float:left;
}
.divchild {
    height: 25px;
    width: 25px;
    background-color: #0F3;
    top: 7px;
    left: 10px;
    margin: auto;
    position: relative;
    text-align:left;
    display:inline-block;
}
$(document).ready(function () {
    $("#Sidebar, #Sidebar .divchild").mouseover(function () {
        $(this).stop().animate({ right: '0px'}, 600);
    }).mouseout(function () {
        $(this).stop().animate({ right: '-170px'}, 600);
    });
});