Мне нужно сделать div disapear слева и сделать второй справа. Для этого я использую следующие функции пользовательского интерфейса jquery:
hide("slide", { direction: "left" }, 1000);
show("slide", { direction: "right" }, 1000);
Проблема, которую я получил, состоит в том, что первый и второй div не привязываются при исчезновении и входе, как вы можете видеть в этой скрипке:
https://jsfiddle.net/oagxfpru/
Я хотел бы сделать, чтобы второй div находился на одной высоте при входе в сцену.
Любая идея? Спасибо за помощь <3
$(document).ready(function() {
$("#second").hide();
$("#toSecond").on('click', function() {
$("#first").hide("slide", { direction: "left" }, 1000);
$("#second").show("slide", { direction: "right" }, 1000);
});
$("#toFirst").on('click', function() {
$("#second").hide("slide", { direction: "left" }, 1000);
$("#first").show("slide", { direction: "right" }, 1000);
})
});
#first{float:left;
width:100%;}
#second{width:100%;}
<body>
<div id='first'>
Some content here<br/>
that should slide to the left<br/>
No problem with that
<input type="button" id="toSecond" value="to second">
</div>
<div id='second'>
This should be at the same height<br/>
then the first div when sliding to the left<br/>
This ain't working properly :/
<input type="button" id="toFirst" value="to first">
</div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js" integrity="sha256-T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=" crossorigin="anonymous"></script>
<script type="text/javascript" src="test.js"></script>
</html>