JSFiddle - React, Tailwind, and code Playground

HTML

<div id='A'></div>
<div id='B'><a href='javascript:' id='toggle'>Toggle</a></div>

CSS

#A, #B {
    position: absolute;
}
#A {
    top: 0px;
    width: 200px;
    bottom: 0px;
    background-color: lime;
}
#B {
    top: 0px;
    left: 200px;
    right: 0;
    bottom: 0px;
    background-color: pink;
}

JavaScript

var p_type = false;

$('#toggle').toggle(function(){
    $('#A').animate({width:0});
    $('#B').animate({left:0});
    console.log(p_type);
    //$("#p_post").load('profile/post.php',{ 'p_type' : p_type }, function(data) {
        p_type = !p_type; //toggle the value for automation
    //});

},function(){
    $('#A').animate({width:200});
    $('#B').animate({left:200});
    console.log(p_type);
    //$("#p_post").load('profile/post.php',{ 'p_type' : p_type }, function(data) {
         p_type = !p_type; //toggle the value for automation
    //});

})