Advertisement
MarkUa

Untitled

Jun 28th, 2019
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5.27 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Chat</title>
  6.    <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.2/css/font-awesome.min.css'>
  7.  
  8.     <style>
  9. body {
  10.     display: flex;
  11.     justify-content: center;
  12.     font-family: "proxima-nova", "Source Sans Pro", sans-serif;
  13.     font-size: 1em;
  14.     color: #32465a;
  15. }
  16. p,ol,ul,li{
  17.     margin:0;
  18.     padding:0;
  19.     border:0;
  20.     font-size:100%;
  21.     font:inherit;
  22.     vertical-align:baseline
  23. }
  24. ol,ul{list-style:none}
  25. .wrapper {
  26.     float: right;
  27.     background: #e8efef;
  28.     width: 35%;
  29.     height: 600px;
  30.     overflow: hidden;
  31.     position: relative;
  32. }
  33.  
  34. .wrapper .message-content {
  35.     height: auto;
  36.     min-height: calc(100% - 93px);
  37.     max-height: calc(100% - 93px);
  38.     overflow-y: scroll;
  39.     overflow-x: hidden;
  40. }
  41.  
  42. .wrapper .message-content::-webkit-scrollbar {
  43.     width: 5px;
  44.     background: transparent;
  45. }
  46. .wrapper .message-content::-webkit-scrollbar-thumb {
  47.     background-color: rgba(0, 0, 0, 0.3);
  48. }
  49. .wrapper .message-content ul li {
  50.     display: inline-block;
  51.     clear: both;
  52.     float: left;
  53.     margin: 5px 15px;
  54.     width: calc(100% - 25px);
  55.     font-size: 0.9em;
  56. }
  57. .wrapper .message-content ul li:nth-last-child(1) {
  58.     margin-bottom: 20px;
  59. }
  60. .wrapper .message-content ul li.received img {
  61.     margin: 6px 8px 0 0;
  62. }
  63. .wrapper .message-content ul li.received p {
  64.     background: #fff;
  65.     color: #111;
  66. }
  67. .wrapper .message-content ul li.sent img {
  68.     float: right;
  69.     margin: 6px 0 0 8px;
  70. }
  71. .wrapper .message-content ul li.sent p {
  72.     background: #0174AD;
  73.     float: right;
  74.     color: #fff;
  75. }
  76. .wrapper .message-content ul li img {
  77.     width: 22px;
  78.     border-radius: 50%;
  79.     float: left;
  80. }
  81. .wrapper .message-content ul li p {
  82.     display: inline-block;
  83.     padding: 10px 15px;
  84.     border-radius: 10px;
  85.     max-width: 300px;
  86. }
  87. .wrapper .msg-box {
  88.     position: absolute;
  89.     bottom: 0;
  90.     width: 100%;
  91.     z-index: 99;
  92. }
  93. .wrapper .msg-box .wrap {
  94.     position: relative;
  95. }
  96. .wrapper .msg-box .wrap input {
  97.  
  98.     float: left;
  99.     border: none;
  100.     width: calc(100% - 90px);
  101.     padding: 11px 32px 10px 8px;
  102.     font-size: 0.8em;
  103.     color: #32465a;
  104. }
  105.  
  106. .wrapper .msg-box .wrap input:focus {
  107.     outline: none;
  108. }
  109.  
  110. .wrapper .msg-box .wrap button {
  111.     float: right;
  112.     border: none;
  113.     width: 50px;
  114.     padding: 12px 0;
  115.     cursor: pointer;
  116.     background: #0174AD;
  117.     color: #f5f5f5;
  118. }
  119. .wrapper .head-img {
  120.     width: 100%;
  121.     height: 60px;
  122.     line-height: 60px;
  123.     background: #f9f9f9;
  124. }
  125. .wrapper .head-img img {
  126.     width: 40px;
  127.     border-radius: 50%;
  128.     float: left;
  129.     margin: 9px 12px 0 9px;
  130. }
  131. .wrapper .head-img p {
  132.     float: left;
  133. }
  134.         </style>
  135. </head>
  136. <body>
  137.  
  138. <div class="wrapper">
  139.     <div class="head-img">
  140.         <img src="user.png" alt="" />
  141.         <p>John Deo</p>
  142.     </div>
  143.     <div class="message-content">
  144.         <ul>
  145.             <li class="received">
  146.                 <img src="user.png" alt="" />
  147.                 <p>How the hell am I supposed to get a jury to believe you when I am not even sure that I do?!</p>
  148.             </li>
  149.             <li class="sent">
  150.                 <img src="user.png" alt="" />
  151.                 <p>When you're backed against the wall, break the god damn thing down.</p>
  152.             </li>
  153.             <li class="received">
  154.                 <img src="user.png" alt="" />
  155.                 <p>Excuses don't win championships.</p>
  156.             </li>
  157.             <li class="received">
  158.                 <img src="user.png" alt="" />
  159.                 <p>Oh yeah, did Michael Jordan tell you that?</p>
  160.             </li>
  161.             <li class="sent">
  162.                 <img src="user.png" alt="" />
  163.                 <p>No, I told him that.</p>
  164.             </li>
  165.             <li class="sent">
  166.                 <img src="user.png" alt="" />
  167.                 <p>What are your choices when someone puts a gun to your head?</p>
  168.             </li>
  169.             <li class="received">
  170.                 <img src="user.png" alt="" />
  171.                 <p>What are you talking about? You do what they say or they shoot you.</p>
  172.             </li>
  173.             <li class="sent">
  174.                 <img src="user.png" alt="" />
  175.                 <p>Wrong. You take the gun, or you pull out a bigger one. Or, you call their bluff. Or, you do any one of a hundred and forty six other things.</p>
  176.             </li>
  177.              <li class="received">
  178.                 <img src="user.png" alt="" />
  179.                 <p>Oh yeah, did Michael Jordan tell you that?</p>
  180.             </li>
  181.             <li class="sent">
  182.                 <img src="user.png" alt="" />
  183.                 <p>No, I told him that.</p>
  184.             </li>
  185.              <li class="received">
  186.                 <img src="user.png" alt="" />
  187.                 <p>Excuses don't win championships.</p>
  188.             </li>
  189.             <li class="sent">
  190.                 <img src="user.png" alt="" />
  191.                 <p>Wrong. You take the gun, or you pull out a bigger one. Or, you call their bluff. Or, you do any one of a hundred and forty six other things.</p>
  192.             </li>
  193.         </ul>
  194.     </div>
  195.     <div class="msg-box">
  196.         <div class="wrap">
  197.             <input type="text" id="message-txt" placeholder="Enter your message..." />
  198.             <button class="submit"><i class="fa fa-paper-plane" aria-hidden="true"></i></button>
  199.         </div>
  200.     </div>
  201. </div>
  202.  
  203. <script src='https://code.jquery.com/jquery-2.2.4.min.js'>
  204. $(".message-content").animate({scrollTop: $(document).height()}, "fast");
  205.  
  206. function sentMessage() {
  207.     message = $("#message-txt").val();
  208.     if ($.trim(message) == '') {
  209.         return false;
  210.     }
  211.     $('' + message + '').appendTo($('.message-content ul'));
  212.     $('#message-txt').val(null);
  213.  
  214.     $(".message-content").animate({scrollTop: $(document).height()}, "fast");
  215. }
  216. $('.submit').click(function () {
  217.     sentMessage();
  218. });
  219.  
  220. $(window).on('keydown', function (e) {
  221.     if (e.which == 13) {
  222.         sentMessage();
  223.         return false;
  224.     }
  225. });
  226. </script>
  227.  
  228. </body>
  229. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement