admin管理员组文章数量:1406177
I have this JSFIDDLE setup demonstrating my problem, I'm sure that it's a simple fix.
I am trying to slide out the blue div to the left, while sliding in the red div from the right, at the same time. The sliding animations are working how I want them to, however when the red div is sliding in it appears below the blue div. How can I get it to be positioned to the right of the blue div instead of appearing beneath it during the animation?
code:
$("#slide2").on('click', function(){
$( "#blueDiv" ).effect( "slide", hideoptions, 1000);
$( "#redDiv" ).effect( "slide", showoptions, 1000);
});
I have this JSFIDDLE setup demonstrating my problem, I'm sure that it's a simple fix.
I am trying to slide out the blue div to the left, while sliding in the red div from the right, at the same time. The sliding animations are working how I want them to, however when the red div is sliding in it appears below the blue div. How can I get it to be positioned to the right of the blue div instead of appearing beneath it during the animation?
code:
$("#slide2").on('click', function(){
$( "#blueDiv" ).effect( "slide", hideoptions, 1000);
$( "#redDiv" ).effect( "slide", showoptions, 1000);
});
Share
Improve this question
asked Apr 23, 2014 at 22:17
A.O.A.O.
3,7636 gold badges32 silver badges49 bronze badges
2 Answers
Reset to default 4You can use position: absolute to take them out of the flow and place them beside each other:
div > div
{
position: absolute;
}
If you want to make it more specific to this div, you can use a specific selector:
#contentWrapper div
{
position: absolute;
}
JSFiddle
http://jsfiddle/ggfA6/12
position: absolute
Both elements need to be absolutely positioned so that they don't occupy space in the flow.
本文标签: javascriptjquery slide effecthide one div and show anotherStack Overflow
版权声明:本文标题:javascript - jquery slide effect, hide one div and show another - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744972203a2635301.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论