JSFiddle - React, Tailwind, and code Playground

by yoowordpress

HTML

<script src="https://cdn.rawgit.com/sirxemic/jquery.ripples/ee02d531/jquery.ripples-min.js"></script>
<body>
<div class="error"></div>
</body>

CSS

* { margin: 0; padding: 0; }
html {
	height: 100%;
}
body {
	color: #fff;
	font-size: 16px;
	font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
	background-image: url(https://bi-file.ru/wp-content/uploads/2017/06/healthy.jpg);
	background-size: cover;
	background-position: 50% 0;
	height: 100%;
	text-align: center;
}
body:before {
	content: '';
	display: inline-block;
	vertical-align: middle;
	height: 100%;
}
main {
	display: inline-block;
	vertical-align: middle;
	background: url(img/bg.jpg);
	padding:  100px;
	max-width: 500px;
	text-shadow: 0 1px 2px rgba(0,0,0,0.5);
	box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
h1 {
	font-size: 32px;
}
h2 {
	font-size: 18px;
	margin-top: 6px;
}
p {
	text-align: left;
	margin-top: 20px;
}
a {
	color: #ff6800;
}
pre {
	text-align: left;
	margin-top: 20px;
}
.error {
	display: none;
	position: fixed;
	bottom: 0;
	left: 0;
	background: #000;
	color: #f00;
	padding: 5px;
	max-width: 50%;
}
button {
	font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
	padding: 0 0.8em;
	line-height: 2em;
	border: none;
	background: #666;
	color: #fff;
	text-shadow: 0 -1px 0 rgba(0,0,0,0.5);
	border-radius: 4px;
	cursor: pointer;
	margin-bottom: 0.5em;
	box-shadow: 0 2px 3px rgba(0,0,0,0.5);
}
button:hover {
	background: #888;
}
code { font-size: 0.8em; display: inline; }
.disable {
	position: fixed;
	bottom: 0;
	right: 0;
}
.code-string { color:#ec7600 }
.code-cbracket { font-weight:bold }
.code-number { color:#ffcd22 }

JavaScript

$(document).ready(function() {
	try {
	
		$('body').ripples({
			resolution: 256,
			dropRadius: 30, //px
			perturbance: .2,
		});
	}
	catch (e) {
		$('.error').show().text(e);
	}

	$('.disable').show().on('click', function() {
		$('body, main').ripples('destroy');
		$(this).hide();
	});

	// Automatic drops
	setInterval(function() {
		var $el = $('main');
		var x = Math.random() * $el.outerWidth();
		var y = Math.random() * $el.outerHeight();
		var dropRadius = 20;
		var strength = 0.04 + Math.random() * 0.04;
		
		$el.ripples('drop', x, y, dropRadius, strength);
	}, 400);
});