I am trying to implement a page transition using the jQuery UI slide effect. Unfortunately, when the transition is underway the page gets chopped off at the top. I have reproduced the issue using this jsfiddle: http://jsfiddle.net/nareshbhatia/CfdEg/1/. Can someone please let me know what I am doing wrong?
Key areas of the code listed below:
HTML
<div id="wrapper">
<div id="page1" class="page">
<p>Page 1</p>
</div>
<div id="page2" class="page nodisplay">
<p>Page 2</p>
</div>
</div>
CSS
body {
font: normal normal 16px Arial;
}
p {
font-size: 40px;
margin: 100px 0 0 0;
}
.nodisplay {
display: none;
}
#wrapper {
position: relative;
width: 480px;
height: 240px;
}
.page {
position: absolute;
width: 100%;
height: 100%;
text-align: center;
}
#page1 {
background-color: #003366;
color: #FFFFFF;
}
#page2 {
background-color: #F6BC0C;
color: #000000;
}
JavaScript
function transitionPage() {
// Hide to left / show from left
$("#page1").toggle("slide", {direction: "left"}, 500);
// Show from right / hide to right
$("#page2").toggle("slide", {direction: "right"}, 500);
}
$(document).ready(function() {
$('#page1').click(transitionPage);
$('#page2').click(transitionPage);
});
Thanks.