Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html class="no-js" lang="">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="x-ua-compatible" content="ie=edge">
- <title></title>
- <meta name="description" content="">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="apple-touch-icon" href="apple-touch-icon.png">
- <!-- Place favicon.ico in the root directory -->
- <style>
- ul#chat{
- height: 100px;
- overflow: scroll;
- }
- </style>
- </head>
- <body>
- <!--[if lte IE 9]>
- <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
- <![endif]-->
- <!-- Add your site or application content here -->
- <p>Hello world! This is HTML5 Boilerplate.</p>
- <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
- <script>window.jQuery || document.write('<script src="js/vendor/jquery-3.1.0.min.js"><\/script>')</script>
- <label> Your Nickname:</label> <input name="name" id="nickname">
- <ul id="chat">
- </ul>
- <textarea id="chatarea"></textarea>
- <div id="story"> John generated blabellela</div>
- </body>
- <script>
- $("textarea").keyup(function(e){
- if((e.keyCode || e.which) == 13) { //Enter keycode
- if($('#nickname').val().length == 0){
- alert('Please insert a nickname');
- }else{
- var text = $('#chatarea').val();
- $('#chat').append('<li> <span class=\"chatter\">' + $('#nickname').val() + ': </span>' + text + '</li>');
- $('#chatarea').val('');
- }
- }
- });
- (function() {
- var index = 0;
- var index2 = 0;
- var comments = [
- "Johnny: this sucks",
- "VanessaXXX: You suck, this website is the shit",
- "Jeffrey: Shut your piehole, Johnny"
- ];
- var stories = [
- "vaneesa has gained",
- "VanessaXXX: You suck, this website is the shit",
- "Jeffrey: Shut your piehole, Johnny"
- ];
- window.setInterval(function(){
- $('#chat').append('<li> <span class=\"chatter\">' + comments[index] + '</li>');
- $('#chat').animate({scrollTop: $('#chat').prop("scrollHeight")}, 500);
- index = index + 1;
- index = index % comments.length;
- }, 2000);
- // story box
- window.setInterval(function(){
- $("#story").slideUp('slow', function() {
- $("#story").html(stories[index]);
- $("#story").slideDown('slow');
- });
- }, 3000);
- //$('#story').fadeTo(1000, 0, function(){ $(this).html().fadeTo(1000, 1); });
- })();
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement