[英]any option to make a area shrink when a drop down button is clicked
I am working on jquery and javascript. 我正在研究jquery和javascript。 I am using a drop down button which will be there on top right corner of the container.
我正在使用一个下拉按钮,该按钮将位于容器的右上角。
So, is there any option to make a container shrink or move to left whenever the drop down button drops down when clicked. 因此,当单击下拉按钮时,是否有任何选项可以使容器缩小或向左移动。 and the same vice-verse.
和同样的副词。
I too have a fiddle which has one the container which slides from left to right and reversal. 我也有一个小提琴 ,里面有一个可以从左向右滑动并反转的容器。 but i am looking for a solution which makes the container to shrinks or moves to left whenever the drop down button is clicked.
但我正在寻找一种解决方案,使该容器在单击下拉按钮时会收缩或向左移动。 here is the fiddle for it.
这是它的小提琴。
CODE: 码:
$('#sidebar').click(function(){
$(this).animate({width:'100px'},{bottom : 100px}, 400);
$('#steam').animate({bottom : 100px},{width:'500px'}, 400);
});
$('#steam').click(function(){
$(this).animate({width:'100px'},{bottom : 100px}, 400);
$('#sidebar').animate({width:'500px'},{bottom : 100px}, 400);
});
try the below solution in js fiddle link. 请尝试以下js小提琴链接中的解决方案。 http://jsfiddle.net/3DpfJ/50/
http://jsfiddle.net/3DpfJ/50/
[1]: http://jsfiddle.net/3DpfJ/50/
http://jsfiddle.net/33rHZ/1/ http://jsfiddle.net/33rHZ/1/
This fiddle uses the .change
event & I have commented out the check for if expanded
, as I don't think you need it. 这个小提琴使用
.change
事件,我已经注释了检查if expanded
,因为我认为您不需要它。 But if you do, simply remove my comments and it should work fine. 但是,如果您这样做,只需删除我的评论即可,它应该可以正常工作。
In summary: 综上所述:
$(function()
{
$('#sidebar').change(function(){
{
$('#sidebar').animate({width:'69%'}, 400);
$('#steam').animate({width:'29%'}, 400);
$('#sidebar').animate({width:'29%'}, 400);
$('#steam').animate({width:'69%'}, 400);
}
});
});
Very tidy. 很干净
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.