Im trying to build an instant messenger in facebook styled bar that sits at the bottom of the screen, after many tries I have a basic setup but Im stuck on how to approach this. I hope my question is concrete enough like this. Think of the Facebook IM thats what I try to replicate in simple form.
I have 2 relevant issues with my code, 1 question:
If you click the green friends div it expands downwards, how to make it expand upwards?
What would be a good way to attach extra divs to the #container when you click any of your friends?
Question:. Can I use components like jquery UI perhaps or is there some good example somewhere to take and learn from? Im relativly jquery newbie and have tried for several hours to find how to do this :(
The html:
<div id="container">
<div id="friends">
Friends: (2) Online
<ul>
<li id="person">Doutzen</li>
<li id="person">Alexandra</li>
</ul>
</div>
container, new chat boxes appear here
</div>
The css:
body {
padding-top: 400px;
}
#container {
background-color: grey;
width: 100%;
height: 30px;
}
#friends {
position: relative;
height: 10px;
color: white;
width: 150px;
background-color: green;
padding: 10px;
float: right;
overflow: hidden;
}
#friends ul li {
padding: 10px;
margin: 10px;
background-color: darkgreen;
}
The Jquery:
$('#friends').toggle(function(){
$(this).animate({'height': '100px'}, 10);
}, function(){
$(this).animate({'height': '10px'}, 10);
});
$(".person").click(function () {
$('#container').append("<div class='chat'>chat with ...</div>");
});
Working example: http://jsfiddle.net/qJCmF/5/