【发布时间】:2016-08-01 10:36:28
【问题描述】:
当前面的 div 较小时,有什么方法可以隐藏 div。 我想为左侧的黑框设置动画,但在通过绿框左侧时可见。 我试过overflow-x: hidden with no lucky..
另一个问题。 我可以使用 jquery toggle() 到绿框吗?我尝试了.toggle("slide"),黑框向左滑动但也执行了缩小..
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"> </script>
<script>
$(document).ready(function(){
$("#green").click(function(){
$("#black").animate({left: '-250px'});
});
});
</script>
</head>
<body>
Click on green box to animate black one
<div id="green" style="background:#98bf21;height:100px;width:100px;position:absolute;margin-left:300px;z-index:10;overflow-x: hidden;"></div>
<div id="black" style="background:#1d1d1c;height:100px;width:260px;position:absolute;margin-left:300px;z-index:1;"></div>
【问题讨论】: