css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div class='app-main'>
	<!-- Left column -->
  <div id="left_col" class="column fixed open">
    <div id="large_nav" class="column">
      <div class="content">
        <div class="top">
          <div id="logo">
            <svg class="svg-logo_twitch" height="32px" version="1.1" viewBox="0 0 94 32" width="94px" x="0px" y="0px">
              <path clip-rule="evenodd" d="M88,5h-6V0h-9l-6,5h-5.5L59,7.5V5h-5V0H36v5H16l-5-5H0v22l5,5.25L14,32h6v-1.5l3,1.5h12l2-3l1,3h7v-3l3,3h8l0.5-3l2.5,3h10l3-3v3h4l3-3v3h7l7-6V10L88,5z M13,13H8v6h5v6H6l-4-4V2h6v5h5V13z M36,21.5L32.5,25H15V7h6v12h2V7h6v12h2V7h5V21.5z M44,25h-6V7h6V25z M44,5h-6V2h6V5z M57,13h-5v6h5v6h-7l-4-4V2h6v5h5V13z M72,13h-7v6h7v6h-9l-4-4V11l4-4h9V13z M91,25h-6V13h-5v12h-6V2h6v5h7l4,4V25z"
              fill-rule="evenodd"></path>
            </svg>
          </div>
          <form action="" id="sidebar_search">
            <input type="text" id="sidebar_query" class="search_input">
          </form>
        </div>
        <div class="bottom"></div>
      </div>
    </div>
  </div>
	
  <!-- Main column -->
  <div id="main_col" class="column scroll">
    <div id="channel">
    <div class="player-column host-frame js-host-frame  ">
      <div class="editable" id="broadcast-meta">
        <a class="profile-link" href="">
          <div class="profile-photo">
            <div class="goto">Go to Profile</div>
            <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/profile.jpeg" alt="lirik">
          </div>
        </a>
        <div class="info">
          <div class="title">
            <span class="over">The Usual - @DatGuyLirik</span>
            <span class="real">The Usual - @DatGuyLirik</span>
          </div>
          
          <div class="channel">
            <a class="channel-name"href="">
              LIRIK
            </a>
            <span class="playing js-playing">
              playing
            </span>
            <a href="">
              DayZ
            </a>
            on
            <a href="">
              The Hammer Squad
            </a>
            
          </div>
        </div>
      </div>
      <div id="player" class="dynamic-player js-player">
        
        <div class="ember-view full" style="height: 100%;">
					<div id="video">
					</div>
				</div>
      </div>
      
      <div class="stats-and-actions clearfix">
        <div class="channel-actions">
            <div id="ember843" class="ember-view ember-follow follow-button is-initialized is-following">
							<a>
								<svg class="svg-heart" height="16px" version="1.1" viewbox="0 0 16 16" width="16px" x="0px" y="0px">
  <path clip-rule="evenodd" d="M8,14L1,7V4l2-2h3l2,2l2-2h3l2,2v3L8,14z" fill-rule="evenodd"></path>
</svg>
								<svg class="svg-unheart" height="16px" version="1.1" viewbox="0 0 16 16" width="16px" x="0px" y="0px">
									<path clip-rule="evenodd" d="M1,9V7h14v2H1z M1,4l2-2h3l2,2l2-2h3l2,2v2H1V4z M8,14l-4.667-4h9.333L8,14z" fill-rule="evenodd">
									</path>
								</svg>
							</a>
					</div>
					<div id="ember856" class="ember-view notification-controls v2" style="">
							<a class="toggle-notification-menu js-toggle-notification-menu" href="#"></a>
					</div>

            <a class="action button primary subscribe-button" id="subscribe_action">
							<span class="subscribe-text">
								Subscribe
							</span>
							<span class="subscribe-price">
								$4.99
							</span>
						</a>

          <span id="ember760" class="ember-view"><div class="popup" style="display: none; position: absolute; top: -287px; left: 177.625px;">
</div>
<span id="ember882" class="ember-view button drop action">Share
</span>
</span>
              <span id="ember1110" class="ember-view button action"><span>Bookmark</span>
</span>
          <div class="theatre-button action">
            <a class="button glyph-only no-padding" data-ember-action="761" original-title="Theater Mode">
              <svg class="svg-theatre" height="16px" version="1.1" viewbox="0 0 16 16" width="16px" x="0px" y="0px">
  <path clip-rule="evenodd" d="M1,13h9V3H1V13z M11,3v10h4V3H11z" fill-rule="evenodd"></path>
</svg>

            </a>
          </div>
          <span id="ember925" class="ember-view"><a class="js-options button glyph-only drop action">
  <svg class="svg-gear" height="16px" version="1.1" viewbox="0 0 16 16" width="16px" x="0px" y="0px">
  <path clip-rule="evenodd" d="M15,7v2h-2.115c-0.125,0.615-0.354,1.215-0.713,1.758l1.484,1.484l-1.414,1.414l-1.484-1.484C10.215,12.531,9.615,12.76,9,12.885V15H7v-2.12c-0.614-0.126-1.21-0.356-1.751-0.714l-1.491,1.49l-1.414-1.414l1.491-1.49C3.477,10.211,3.247,9.613,3.12,9H1V7h2.116C3.24,6.384,3.469,5.785,3.829,5.242L2.343,3.757l1.414-1.414l1.485,1.485C5.785,3.469,6.384,3.24,7,3.115V1h2v2.12c0.613,0.126,1.211,0.356,1.752,0.714l1.49-1.491l1.414,1.414l-1.49,1.492C12.523,5.79,12.754,6.387,12.88,7H15z M8,6C6.896,6,6,6.896,6,8s0.896,2,2,2s2-0.896,2-2S9.104,6,8,6z" fill-rule="evenodd"></path>
</svg>

</a>
</span>
        </div>
        <div class="channel-stats">
          <span id="ember1100" class="ember-view live-count stat" original-title="Watching Now"><svg class="svg-glyph_live" height="16px" version="1.1" viewbox="0 0 16 16" width="16px" x="0px" y="0px">
  <path clip-rule="evenodd" d="M11,14H5H2v-1l3-3h2L5,8V2h6v6l-2,2h2l3,3v1H11z" fill-rule="evenodd"></path>
</svg>

          28,415
</span>
          <span id="ember770" class="ember-view stat" original-title="Total Views"><svg class="svg-glyph_views" height="16px" version="1.1" viewbox="0 0 16 16" width="16px" x="0px" y="0px">
  <path clip-rule="evenodd" d="M11,13H5L1,9V8V7l4-4h6l4,4v1v1L11,13z M8,5C6.344,5,5,6.343,5,8c0,1.656,1.344,3,3,3c1.657,0,3-1.344,3-3C11,6.343,9.657,5,8,5z M8,9C7.447,9,7,8.552,7,8s0.447-1,1-1s1,0.448,1,1S8.553,9,8,9z" fill-rule="evenodd"></path>
</svg>

          87,920,050
</span>
          <span id="ember771" class="ember-view stat" original-title="Followers"><svg class="svg-glyph_followers" height="16px" version="1.1" viewbox="0 0 16 16" width="16px" x="0px" y="0px">
  <path clip-rule="evenodd" d="M8,13.5L1.5,7V4l2-2h3L8,3.5L9.5,2h3l2,2v3L8,13.5z" fill-rule="evenodd"></path>
</svg>

          976,562
</span>
        </div>
      </div>
      
    </div>
  </div>
  </div>
	<div id="right_col" class="open column fixed">
    <div class='chat-container float-right'>
      <div class="chat-header">
        <a class="button glyph-only left">
          <svg class="svg-roomlist" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px">
            <path clip-rule="evenodd" d="M1,13v-2h14v2H1z M1,5h13v2H1V5z M1,2h10v2H1V2z M12,10H1V8h11V10z" fill-rule="evenodd"></path>
          </svg>
        </a>
        <p class="room-title">avalonstar</p>
      </div>
      <div class="chat-room">
        <div class="scroll chat-messages hideTimestamps hideModIcons">
          <ul class="chat-lines">
            <!-- message template :: ADMIN -->
            <li class="message-line chat-line admin">
              <div class="indicator"></div>
              <span class="timestamp float-left">2:32</span>
              <span class="mod-icons float-left">
                <a class="mod-icon float-left tooltip ban" title="Ban User" href="#">Ban</a>
                <a class="mod-icon float-left tooltip timeout" title="Timeout User" href="#">Timeout</a>
              </span>
              <span class="badges float-left">
              </span>
              <span class="from" style="color:#0000FF">Jtv</span>
              <span class="colon">:</span>
              <span class="message" style="undefined">Welcome to the chat room!
              </span>
            </li>
            <!-- message template :: USER -->
            <li id="ember2673" class="ember-view message-line chat-line">
              <div class="indicator"></div>
              <span class="timestamp float-left">3:16</span> 
              <span class="mod-icons float-left">
                <a class="mod-icon float-left tooltip ban" title="Ban User" href="#">Ban</a>
                <a class="mod-icon float-left tooltip timeout" title="Timeout User" href="#">Timeout</a>
              </span> 
              <span class="badges float-left">
                <div class="badge float-left tooltip turbo" title="Turbo"></div>
              </span>
              <span class="from" style="color:#8A2BE2">OMGElsie</span>
              <span class="colon">:</span> 
              <span class="message" style="undefined">
                <img class="emoticon tooltip" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/244634/Kappa.png" alt="Kappa" original-title="Kappa"> 
              </span>
            </li>
          </ul>
        </div>
      </div>
      <div class="chat-interface">
				<div id="chattooltip">
					<div class="chattooltip__inventory">
						You have 10,000 Bits
						<div class="chattooltip__buybtn">
							<a href="">Buy Bits</a>
						</div>
					</div>
					<div class="chattooltip__context">
						<div class="chattooltip__context--img">
							
						</div>
						<div class="chattooltip__context--text">
							<span class='chattooltip__context--infotext'>Type giveBits to start giving!</span>
						</div>
					</div>
				</div>
        <div class="textarea-contain">
          <textarea id="chat-message" placeholder="Send a message"></textarea>
					<a class="bits-selector-toggle">
            <svg class='svg-emoticons' version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 18 18" enable-background="new 0 0 18 18" xml:space="preserve">
<polygon fill="#FFFFFF" stroke="#CCCCCC" stroke-width="2" stroke-miterlimit="10" points="2.7,14.4 9,3.6 15.3,14.4 "/>
</svg>
          </a>
          <a class="emoticon-selector-toggle">
            <svg class="svg-emoticons" height="18px" version="1.1" viewBox="0 0 18 18" width="18px" x="0px" y="0px">
      <path clip-rule="evenodd" d="M9,18c-4.971,0-9-4.029-9-9s4.029-9,9-9s9,4.029,9,9S13.971,18,9,18z M14,4.111V4h-0.111C12.627,2.766,10.904,2,9,2C7.095,2,5.373,2.766,4.111,4H4v0.111C2.766,5.373,2,7.096,2,9s0.766,3.627,2,4.889V14l0.05-0.051C5.317,15.217,7.067,16,9,16c1.934,0,3.684-0.783,4.949-2.051L14,14v-0.111c1.234-1.262,2-2.984,2-4.889S15.234,5.373,14,4.111zM11,6h2v4h-2V6z M12.535,12.535C11.631,13.44,10.381,14,9,14s-2.631-0.56-3.536-1.465l0.707-0.707C6.896,12.553,7.896,13,9,13s2.104-0.447,2.828-1.172L12.535,12.535z M5,6h2v4H5V6z" fill-rule="evenodd"></path>
    </svg>
          </a>
        </div>
        <div class="chat-buttons-container clearfix">
          <a class="button glyph-only float-left">
            <svg class="svg-gear" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px">
      <path clip-rule="evenodd" d="M15,7v2h-2.115c-0.125,0.615-0.354,1.215-0.713,1.758l1.484,1.484l-1.414,1.414l-1.484-1.484C10.215,12.531,9.615,12.76,9,12.885V15H7v-2.12c-0.614-0.126-1.21-0.356-1.751-0.714l-1.491,1.49l-1.414-1.414l1.491-1.49C3.477,10.211,3.247,9.613,3.12,9H1V7h2.116C3.24,6.384,3.469,5.785,3.829,5.242L2.343,3.757l1.414-1.414l1.485,1.485C5.785,3.469,6.384,3.24,7,3.115V1h2v2.12c0.613,0.126,1.211,0.356,1.752,0.714l1.49-1.491l1.414,1.414l-1.49,1.492C12.523,5.79,12.754,6.387,12.88,7H15z M8,6C6.896,6,6,6.896,6,8s0.896,2,2,2s2-0.896,2-2S9.104,6,8,6z" fill-rule="evenodd"></path>
    </svg>
          </a>
          <a class="button glyph-only float-left">
            <svg class="svg-viewerlist" height="16px" version="1.1" viewBox="0 0 16 16" width="16px" x="0px" y="0px">
              <path clip-rule="evenodd" d="M6,12.999v-2h8v2H6z M6,6.999h8v2H6V6.999z M6,2.999h8v2H6V2.999z M2,10.999h2v2H2V10.999z M2,6.999h2v2H2V6.999z M2,2.999h2v2H2V2.999z" fill-rule="evenodd"></path>
            </svg>
          </a>
          <button class="button primary float-right send-chat-button">Chat</button>
        </div>
      </div>
    </div>
</div>
</div>
            
          
!
            
              .float-left
	float: left

.float-right
	float: right

.clearfix
	clear: both

.clearfix:after
	visibility: hidden
	display: block
	font-size: 0
	clear: both
	height: 0
	
textarea
	line-height: 28px
	font: inherit
	letter-spacing: inherit
	color: #666
	vertical-align: top
	border: 1px solid rgba(0, 0, 0, 0.25)
	background-clip: padding-box
	background: #fff
	padding: 7px

	&:focus
		outline: 0
		box-shadow: 0 0 3px 1px rgba(185,155,235,0.75)
		border: 1px solid rgba(100,65,165,0.75)

body
	margin: 0
	padding: 0
	font: normal 12px Helvetica, sans-serif

.button
	position: absolute
	display: inline-block
	position: relative
	cursor: pointer
	line-height: 30px
	height: 30px
	font-size: 14px
	font-family: inherit
	padding: 0
	color: #6441a5
	border: 0
	background: none

	&.primary
		background: #6441a5
		color: #fff
		padding: 0 10px
		font-size: 12px

	&.left
		left: 20px
	
	&.glyph-only
		padding: 0 10px
	
	svg
		path
			fill: #6441a5

.chat-container
	position: absolute
	top: 0
	bottom: 0
	right: 0
	width: 340px
	background-color: #f2f2f2

.chat-header
	height: 30px
	padding: 10px 0
	line-height: 30px
	text-align: center
	font-size: 14px
	width: 100%
	box-shadow: inset 0 -1px 0 0 #dedede

	.button
		position: absolute
		top: 10px
		
		&.left
			left: 20px
			padding-left: 0
	
		&.right
			right: 20px
			padding-right: 0

	.svg-roomlist
		width: 16px
		height: 16px
		margin-top: 7px
		margin-bottom: 7px
		float: left

.chat-room
	top: 50px
	left: 0
	right: 0
	bottom: 0
	position: absolute
	display: block
	background-clip: content-box

.scroll
	position: relative
	overflow: hidden
	width: auto
	height: auto

.chat-messages
	position: absolute
	width: auto
	height: auto
	top: 0px
	bottom: 111px
	left: 0
	right: 0
	overflow: hidden

	&.hideTimestamps
		.timestamp
			display: none

	&.hideModIcons
		.mod-icons
			display: none

	.chat-lines
		padding: 10px 0
		list-style-type: none

	.chat-line
		line-height: 20px
		padding: 4px 20px
		word-wrap: break-word
		list-style-position: unset
	
		.emoticon
			background-position: center center
			background-repeat: no-repeat
			display: inline-block
			vertical-align: middle
			margin: -5px 0
	
		&.admin
			padding: 10px 20px

		&.admin, &.notification
			.timestamp, .mod-icons, .from, .colon
				display: none
			.message
				color: #666
		.from, .to
			font-weight: bold
	
			&:hover
				cursor: pointer
				text-decoration: underline
.badges
	@extend .clearfix
	float: left

	.badge
		height: 18px
		min-width: 18px
		display: inline-block
		vertical-align: middle
		float: left
		margin: 1px 3px 1px 0

		&.broadcaster
			background: #e71818 url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/244634/badge_broadcaster.svg')
			background-size: 100%

		&.turbo
			cursor: pointer
			background: #6441a5 url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/244634/badge_turbo.svg')
			background-size: 100%

		&.staff
			background: #200f33 url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/244634/badge_broadcaster.svg')
			background-size: 100%
	
.chat-interface
	color: #8c8c8c
	border-color: #3b3b3b
	width: 100%
	position: absolute
	bottom: 0
	padding: 0 20px 20px
	box-sizing: border-box
	
.textarea-contain
	width: 100%
	height: 50px
	margin-bottom: 10px
	position: relative

	textarea
		width: 300px
		height: 50px
		padding-right: 25px
		margin: 0
		resize: none
		box-sizing: border-box

.emoticon-selector-toggle
	display: block
	width: 18px
	height: 18px
	top: 5px
	right: 5px
	position: absolute
	cursor: pointer

	svg path
		fill: rgba(0,0,0,0.2)

		&:hover
			svg path
				fill: rgba(0,0,0,0.5)

.chat-buttons-container
	width: 100%
	display: block

	.glyph-only
		min-width: 14px
		&:first-child
			padding-left: 0
  
#video
	width: 100%
	height: 500px

#chattooltip
	width: 99%
	background-color: white
	border: 1px solid #cccccc
	position: relative
	top: -10px
	display: none
	height: 77px

	img
		width: 40px
		height: 40px


.chattooltip__inventory
	height: 10px
	padding: 7px 10px 10px 10px
	border-bottom: 1px solid #cccccc

.chattooltip__buybtn
	float: right
	
.chattooltip__context
	display: table
	width: 100%
	height: 40px

.chattooltip__context--img
	width: 25px
	height: 32px
	display: table-cell
	padding: 8px 0 0 8px

	img
		vertical-align: middle
		padding-bottom: 5px

.chattooltip__context--text
	color: #32323E
	display: table-cell
	width: 200px
	height: 25px
	font-size: 14px

.chattooltip__context--infotext
	color: #A6A6A6
	font-style: italic

.chattooltip__context--errortext
	color: #D44B4B
	font-style: italic
	font-size: 12px

.bits-selector-toggle
	display: block
	width: 18px
	height: 18px
	top: 5px
	right: 30px
	position: absolute
	cursor: pointer

	svg path
		fill: rgba(0,0,0,0.2)

		&:hover
			svg path
				fill: rgba(0,0,0,0.5)

.pulse-bit
	animation: pulse 3s infinite

.bitcolor-1
	color: #3D3D3D
.bitcolor-10
	color: #9C3EE8
.bitcolor-100
	color: #1DB2A5
.bitcolor-500
	color: #0099FE
.bitcolor-1000
	color: #F43021
.bitcolor-10000
	color: #FFD043


.bit-line
	background-color: #E9E5F4
	margin: 3px 0

	img
		margin: -5px 5px 0 0

@keyframes pulse
	0%
		opacity: 0
	50%
		opacity: 1
	100%
		opacity: 0
            
          
!
            
              var currentMessage;

//GIVE BITS
var isBitsActive = false;
var hasBits = false;
var numBits;

//SEND CHAT MESSAGE

$("#chat-message").keyup(function(event){

	currentMessage = $("#chat-message").val();
	var code = (event.keyCode ? event.keyCode : event.which);
	//if giveBits exists in the message
	if (currentMessage.indexOf('giveBits') !== -1){
		//if tooltip is inactive, show it
		if(!isBitsActive){
			showBitsTooltip();
		}

		//replace text to say "type a number"
		$(".chattooltip__context--text").html("<span class='chattooltip__context--infotext'>Type a number</span>");

		//get number after giveBits
		numBits = currentMessage.split('giveBits')[1];
		if(isNumeric(numBits)){
			getBitType(numBits);
		}
		if(code == 13){
			$(".chat-lines").append('<li class="ember-view message-line chat-line bit-line"><div class="indicator"></div><span class="timestamp float-left">3:16</span><span class="mod-icons float-left"><a class="mod-icon float-left tooltip ban" title="Ban User" href="#">Ban</a><a class="mod-icon float-left tooltip timeout" title="Timeout User" href="#">Timeout</a></span><span class="badges float-left"><div class="badge float-left tooltip turbo" title="Turbo"></div></span><span class="from" style="color:#8A2BE2">OMGElsie</span><span class="colon">:</span><span class="message" style="undefined"> ' + '<span class="bitcolor-100"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/100.gif" /><strong>420</strong></span>' + '</span></li>');
			$("#chat-message").val('');
			$("#chat-message").focus();
			hideBitsTooltip();
			event.preventDefault();
		}
		if(code == 32) {
			hideBitsTooltip();
			if(numBits == 0 || numBits == ''){
				showBitsError();
			}
			if(numBits > 10000){
				showBitsMaxError();
			}
		}
	}
	//if message doesn't have giveBits, hide tooltip
	else if(currentMessage.indexOf('giveBits') == -1) {
		hideBitsTooltip();
	}
});

//is number
function isNumeric(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
}

//Show/Hide tooltip
$('.bits-selector-toggle').click(function(){
	if(!isBitsActive){ 
		showBitsTooltip();
		resetBitsTooltip();
	}
	else {
		hideBitsTooltip();
	}
});

function showBitsTooltip(){
	
	$(".chattooltip__context--img").html("<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/bit-default.png' class='pulse-bit' />");
	$("#chattooltip").show();
	getBitType(numBits);
	isBitsActive = true;
}

function hideBitsTooltip(){
	$("#chattooltip").hide();
	isBitsActive = false;
}

//Get Bit Type Range
function getBitType(n){
	if (withinRange(n, 1, 9)){
		$(".chattooltip__context--img").html("<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/1.gif'/>");
		$(".chattooltip__context--text").html("<strong><span class='bitcolor-1'>" + n + "</strong></span>");
	}
	if (withinRange(n, 10, 99)) {
		$(".chattooltip__context--img").html("<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/10.gif'/>");
		$(".chattooltip__context--text").html("<strong><span class='bitcolor-10'>" + n + "</strong></span>");
	}
	if (withinRange(n, 100, 499)) {
		$(".chattooltip__context--img").html("<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/100.gif'/>");
		$(".chattooltip__context--text").html("<strong><span class='bitcolor-100'>" + n + "</strong></span>");
	}
	if (withinRange(n, 500, 999)){
		$(".chattooltip__context--img").html("<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/500.gif'/>");
		$(".chattooltip__context--text").html("<strong><span class='bitcolor-500'>" + n + "</strong></span>");
	}
	if (withinRange(n, 1000, 9999)){
		$(".chattooltip__context--img").html("<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/1000.gif'/>");
		$(".chattooltip__context--text").html("<strong><span class='bitcolor-1000'>" + n + "</strong></span>");
	}
	else if (n >= 10000){
		$(".chattooltip__context--img").html("<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/10000.gif'/>");
		$(".chattooltip__context--text").html("<strong><span class='bitcolor-10000'>" + n + "</strong></span>");
	}
}

function withinRange(x, min, max) {
  return x >= min && x <= max;
}

function showBitsError(){
	$(".chattooltip__context--img").html("<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/bits-error.png' class='pulse-bit' />");
	$(".chattooltip__context--text").html("<span class='chattooltip__context--errortext'>You need to add a number to giveBits!</span>");
	$("#chattooltip").show();
}

function showBitsMaxError(){
	$(".chattooltip__context--img").html("<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/bits-error.png' class='pulse-bit' />");
	$(".chattooltip__context--text").html("<span class='chattooltip__context--errortext'>You don't have enough Bits!</span>");
	$("#chattooltip").show();
}

function resetBitsTooltip(){
	numBits = 0;
	$(".chattooltip__context--img").html("<img src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-140/bit-default.png' class='pulse-bit' />");
	$(".chattooltip__context--text").html("<span class='chattooltip__context--infotext'>Type giveBits to start giving!</span>");
}
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console