I'm creating a simple chat system where you have a function that opens the user window to which you want to chat face style. What I would like to know is how when opening the second user the window gets lined up next to the first window and not above that is what is happening. This is the code at the moment.
<script>
$(document).ready(function () {
$('.chat').die('click').live("click", function () {
var chat = $(this).attr("rel");
var URL = 'chat.php';
var dataString = 'chat=' + chat;
$.ajax({
type: "POST",
url: URL,
data: dataString,
cache: false,
success: function (html) {
$("body").append("<div id='main" + chat + "'></div>")
$("#main" + chat).html(html);
}
});
return false;
});
});
</script>
CSS
<style>
#chatbox {
position: absolute;
bottom: 0px;
width: 200px;
height: 300px;
z-index: 4;
background-color: #ECECEC;
border: 1px solid #000;
}
</style>
HTML
<a class="chat" rel="8" href="#">user A </a>
<br/>
<a class="chat" rel="7" href="#">user b </a>