I have an unordered list that I'm hoping to add the effect that when something is appended to it, it appears in a random position on the screen every time. However, since it's text in the list, I can't have each random position overlap. The text that gets appended will have a fadeout timer of 5 seconds, so once the message has faded out, that space will become available.
Is this possible? If so here is the HTML I'm using:
<ul id="messagebox" >
</ul>
<div>
<input type="text" id="typetextbox" maxlength="120" autocomplete="off" />
<button type="submit" id="submit" onblur="submit"> </button>
</div>
Here's the Javascript/jquery:
$(document).ready(function(){
$('#typetextbox').keypress(function (e){
if(e.keyCode == 13 ) $('#submit').click();
});
$('#submit').click(function(){
var message = $('#typetextbox').val();
if (message.replace(/ /g, ''))
$('#messagebox').append(message + "<br/>");
$("#typetextbox").val("");
});
});
If not, what can I do to get that effect?
Thanks guys!