<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Simple Responsive Chat / Messenger</title>
<link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Lato:300,400'>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1 class="title">Simple Responsive Chat / Messenger</h1>
<p class="description"><em>Go ahead and add a message.</em></p>
<ul class="messages">
<li class="message">
<h1 class="name">Chris Hutchinson</h1><img class="user" src="http://lorempixel.com/200/200"/>
<p class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus porta condimentum ante id tristique. Nulla eget vestibulum dolor.</p>
</li>
<li class="message">
<h1 class="name">Nic Cage</h1><img class="user" src="http://lorempixel.com/210/210"/>
<p class="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus porta condimentum ante id tristique. Nulla eget vestibulum dolor.</p>
</li>
</ul>
<textarea class="message" placeholder="Your message..."></textarea>
<div class="actions">
<button>Send</button>
</div>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src="js/index.js"></script>
</body>
</html>
/*Downloaded from https://www.codeseek.co/chrishutchinson/simple-responsive-chat-messenger-hwsCr */
*, *:before, *:after {
box-sizing: border-box;
}
html {
min-height: 100%;
}
body {
height: 100%;
font-family: 'Lato', sans-serif;
font-weight: 300;
font-size: 14px;
background: #eaeaea;
overflow: auto;
margin: 0;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #EBE7DE), color-stop(1, #CBC7B7));
}
h1, h2, h3, h4, h5, h6 {
font-weight: 300;
margin: 0;
}
h1.title {
padding: 7px 20px 10px;
margin: 0 0 20px 0;
background: #333;
color: #FFF;
width: 100%;
font-size: 1.4em;
}
p.description {
padding: 0 20px;
}
ul {
letter-spacing: -4px;
}
ul li {
letter-spacing: normal;
}
ul.messages {
padding: 20px;
list-style-type: none;
margin: 0 0 130px 0;
overflow: hidden;
}
ul.messages li.message {
display: block;
clear: both;
overflow: hidden;
margin: 0 0 10px 0;
}
ul.messages li.message img.user {
height: auto;
width: 70px;
border-radius: 50%;
float: left;
margin: 0 20px 20px 0;
}
ul.messages li.message h1.name {
display: block;
font-size: 1.2em;
text-transform: uppercase;
color: #8b8b8b;
margin: 0 0 5px 0;
text-align: right;
}
ul.messages li.message p.text {
display: block;
background-color: rgba(221, 246, 255, 0.6);
padding: 7px 20px;
margin: 0 0 0 35px;
line-height: 1.4em;
border-radius: 0px 4px 4px 4px;
}
ul.messages li.message p.text:hover {
background-color: rgba(221, 246, 255, 0.8);
}
ul.messages li.message:nth-of-type(2n) h1.name {
text-align: left;
}
ul.messages li.message:nth-of-type(2n) img.user {
float: right;
margin: 0 0 10px 10px;
}
ul.messages li.message:nth-of-type(2n) p.text {
background-color: rgba(221, 255, 235, 0.6);
margin: 0 35px 0 0;
border-radius: 4px 0 4px 4px;
}
ul.messages li.message:nth-of-type(2n) p.text:hover {
background-color: rgba(221, 255, 235, 0.8);
}
textarea.message {
position: fixed;
bottom: 30px;
left: 0;
width: 100%;
border: 0;
padding: 10px;
font-family: 'Lato', sans-serif;
font-weight: 300;
height: 100px;
-webkit-appearance: none;
outline: 0;
border-top: 3px solid #3e3e3e;
background: rgba(255, 255, 255, 0.7);
}
textarea.message:focus {
background: white;
}
textarea.message.required {
background: #ffdddd;
}
div.actions {
position: fixed;
bottom: 0;
left: 0;
height: 30px;
background: #FFF;
width: 100%;
}
div.actions button {
float: right;
width: 100%;
height: 30px;
font-size: 1.1em;
background: #3e3e3e;
color: #FFF;
border: 0;
padding: 5px 12px;
-webkit-appearance: none;
outline: 0;
font-family: 'Lato', sans-serif;
font-weight: 300;
cursor: pointer;
}
div.actions button:hover {
background: #252525;
}
/*Downloaded from https://www.codeseek.co/chrishutchinson/simple-responsive-chat-messenger-hwsCr */
$(document).ready(function(){
$('button').click(function(){
var value = $('textarea.message').val();
if(value != ''){
var message = $('li.message').first().clone();
$(message).find('p.text').html(value);
$('ul.messages').append(message);
$('textarea.message').val('');
$('html, body').animate({ scrollTop: $(document).height() }, 700);
$('textarea.message').removeClass('required');
} else {
$('textarea.message').addClass('required');
}
});
});