Question

I use the following to load a new page within the current page, no refresh.

$(document).ready(function(){
$("#leftnav").click(function(){
    $.post("regions.php",function(data){document.write(data)},"html")
    return false;
});

});

Is it possible to animate the new page with jquery, like slide up the new page?

Thanks,

Was it helpful?

Solution

The following will add the new content to a hidden div, append to the body and then slideDown.

$(document).ready(function(){
    $("#leftnav").click(function(){
        $.post("regions.php",function(data){
            //create a div and hide it
            //append new content then slideDown  
            $('<div />').hide()
                        .html(data)
                        .appendTo('body')
                        .slideDown()
        return false;
    });
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top