On my webpage, I have two full-width divs that I want to show one at a time using JQueryUI slide transitions. The desired effect is for one div to slide away to the left while the other slides in from the right. However, the current issue is that both animations occur simultaneously, causing the second div to initially appear below the first before sliding up to replace it at the end of the animation. How can I adjust the positioning of the second div to create a seamless sliding motion?
Here's the code snippet:
<script type="text/javascript">
$('#schedule').hide();
$( '#changer' ).click(function() {
$("#roster").toggle( "slide", {direction: "left"}, "fast" );
$("#schedule").toggle("slide", { direction: "right"}, "fast");
if ($("#changer").html() == 'Schedule View')
$("#changer").html('Roster View');
else
$("#changer").html("Schedule View");
});
</script>