Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

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.

HTML

            
              <main>
	<h1>Subscribe to ACME newsletter </h1>
	<p id="tagline">(not really its a demo)</p><br>
	<p id="tagline">よろしくお願いします!</p>
	<form>
		<fieldset>
			<label for="text"><i class="fal fa-user-alt"></i> name*</label>
			<input id="input-name" name="name" type="text" placeholder="name" required/>
		</fieldset>
		<fieldset>
			<label for="email"><i class="fal fa-at"></i> email*</label>
			<input id="input-email" name="email" type="email" placeholder="email address" required/>
		</fieldset>
		<div id="loading">Loading Consentua</div>
		<iframe scrolling="no" id="consentua-cookie-widget"></iframe>
	</form>
	<div id="btn-group">
		<button type="submit" id="submitBtn">
                <span id="sp" class="hidden">subscribe</span>
                <i id="sn" class="fas fa-sync-alt fa-spin"></i>
                <i id="ck" class="fas fa-check hidden"></i>
            </button>
		<button id="recept-btn">
                <i class="fas fa-receipt"></i> Save your consent reciept</button>
	</div>
	<span>
            <a id="recept-link" href="#">Reset</a>
            <a id="viewer_link" href="https://viewer.openconsent.com/receipt/view_receipt.php">Receipt Viewer</a>
        </span>
</main>
<div id="toast"></div>
            
          
!

CSS

            
              @keyframes loadBar {
	0% {
		left: -110%;
	}
	100% {
		left: 110%;
	}
}
body {
	background-color: #80deea;
	background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.71' fill-rule='evenodd'/%3E%3C/svg%3E");
	font-family: "Kosugi Maru", sans-serif;
}
.hidden {
	display: none !important;
}
main {
	max-width: 90vw;
	height: 800px;
	margin: 2rem auto;
	background: #fff;
	padding: 2rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: space-around;
}
main::after {
	content: "";
	display: block;
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: 20px;
	background: #e91e63;
}
form {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: space-around;
	overflow: hidden;
	height: auto;
	flex: 1;
	transition: flex 0.3s ease-out;
}
fieldset {
	border: none;
	display: flex;
	flex-direction: column;
	justify-content: space-around;
	align-items: center;
}
fieldset > label {
	margin-bottom: 1rem;
}
fieldset > input {
	border: 1px solid lightgrey;
	font-size: 1rem;
	padding: 0.5rem 1rem;
	margin-bottom: 1rem;
	width: 300px;
	z-index: 1;
}
fieldset > input.invalid {
	border-color: #e53935;
	background: #ef9a9a;
}
fieldset::after {
	content: "";
	position: relative;
	z-index: 0;
	transform: translate(8px, -58px);
	height: 34px;
	border: 1px solid #e91e63;
}
#loading {
	font-family: "Open Sans", sans-serif;
	width: 500px;
	display: block;
	position: relative;
	color: #fff;
	background-color: #e91e63;
	padding: 1rem;
	margin: 1.5rem auto;
	text-align: center;
	border-radius: 10px;
	overflow: hidden;
}
#loading:after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 70%;
	height: 100%;
	background-color: rgba(255, 255, 255, 0.4);
	-webkit-animation: loadBar 2s cubic-bezier(0.09, 0.89, 0.7, 0.71) infinite;
	-moz-animation: loadBar 2s cubic-bezier(0.09, 0.89, 0.7, 0.71) infinite;
	animation: loadBar 2s cubic-bezier(0.09, 0.89, 0.7, 0.71) infinite;
}
iframe {
	width: 800px;
	height: 260px !important;
	border: none;
}
#btn-group {
	display: block;
}
#btn-group button {
	display: block;
	position: relative;
	border: none;
	background: #039be5;
	color: #fff;
	padding: 1rem;
	border-radius: 0.4rem;
	width: 180px;
	height: 60px;
	z-index: 1;
	font-size: 1.2rem;
	cursor: pointer;
}
#btn-group button#recept-btn {
	padding: 0.6rem 1rem;
	display: flex;
	align-items: center;
	flex-direction: column;
	justify-content: flex-end;
	font-size: 0.8rem;
	z-index: 0;
	background-color: #607d8b;
	transition: all 0.5s ease-in 0s;
	transform: translatey(-60px);
}
.drop {
	transform: translatey(-10px) !important;
}
.green {
	background-color: #66bb6a !important;
}
#btn-group button:hover {
	filter: brightness(110%);
}
*:focus {
	outline: 0;
}
a#viewer_link {
	width: 100%;
	display: block;
	text-align: center;
}
#toast {
	position: fixed;
	top: 0;
	left: 50%;
	transform: translate(-50%);
	background-color: #e53935;
	color: #fff;
	padding: 16px 20px;
	border-radius: 4px;
	text-align: center;
	z-index: 1;
	box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
	visibility: hidden;
	opacity: 0;
}

#toast.show {
	visibility: visible;
	animation: fadeInOut 3s;
}

@keyframes fadeInOut {
	5%,
	95% {
		opacity: 1;
		top: 50px;
	}
	15%,
	85% {
		opacity: 1;
		top: 30px;
	}
}

            
          
!

JS

            
              function showToast(text) {
	var x = document.getElementById("toast");
	x.classList.add("show");
	x.innerHTML = text;
	setTimeout(function() {
		x.classList.remove("show");
	}, 3000);
}
var form = document.querySelector("form"),
	sp = document.getElementById("sp"),
	sn = document.getElementById("sn"),
	ck = document.getElementById("ck"),
	inputName = document.getElementById("input-name"),
	inputEmail = document.getElementById("input-email"),
	sbbt = document.getElementById("submitBtn"),
	rclnk = document.getElementById("recept-link"),
	rcbt = document.getElementById("recept-btn"),
	tagline = document.getElementById("tagline");

//on submit
sbbt.addEventListener("click", function(event) {
	event.preventDefault();
	if (inputName.checkValidity() && inputEmail.checkValidity()) {
		sp.classList.add("hidden");
		sn.classList.remove("hidden");
		setTimeout(function() {
			rcbt.classList.add("drop");
			sn.classList.add("hidden");
			ck.classList.remove("hidden");
			sbbt.classList.add("green");
			form.style.flex = "0";
			tagline.innerHTML = "ありがとうございました!❤";
			inputName.classList.remove("invalid");
			inputEmail.classList.remove("invalid");
		}, 1500);
	} else {
		showToast("Please fill in the form correctly");
		inputName.classList.add("invalid");
		inputEmail.classList.add("invalid");
	}
});

//on reset
rcbt.addEventListener("click", function(event) {
	event.preventDefault();
	sbbt.classList.remove("green");
	sp.classList.remove("hidden");
	sn.classList.add("hidden");
	ck.classList.add("hidden");
	rcbt.classList.remove("drop");
	form.style.flex = "1";
	tagline.innerHTML = "よろしくお願いします!";
	inputName.classList.remove("invalid");
	inputEmail.classList.remove("invalid");
	window.location.href =
		"https://api.consentua.com/ConsentReceipt/GetConsentReceipt?consentReceiptId=61594AB0-B81E-4A0B-8F7F-E50B5DF52639&version=KI-CR-v1.0.0";
});

//on reset
rclnk.addEventListener("click", function(event) {
	event.preventDefault();
	sbbt.classList.remove("green");
	sp.classList.remove("hidden");
	sn.classList.add("hidden");
	ck.classList.add("hidden");
	rcbt.classList.remove("drop");
	form.style.flex = "1";
	tagline.innerHTML = "よろしくお願いします!";
	inputName.classList.remove("invalid");
	inputEmail.classList.remove("invalid");
});

//Consentua setup
var ccid = "266"; // Customer ID
var csid = "25"; // Consentua service ID
var cskey = "ad2e97aa-2fbe-4993-92fe-598fc26a33ba"; // Consentua service key
var ctid = "20"; // Template ID
var cuid = false;
var ccb_ready = function(msg) {
	//When consentua is ready open/dont open modal
	console.log("UID is:" + msg.message.uid);
	document.getElementById("loading").classList.add("hidden");
	sp.classList.remove("hidden");
	sn.classList.add("hidden");
};
var ccb_set = function(msg) {
	//update cookie when consent is set
	console.log("Consent received from Consentua", msg);
};
var ciframe = document.getElementById("consentua-cookie-widget");
var ccwrap = new ConsentuaUIWrapper(
	ciframe,
	ccid,
	cuid,
	ctid,
	csid,
	cskey,
	function() {},
	"en",
	{
		ix: "https://kni-test-node.herokuapp.com/custom-interaction.html"
	}
);
// set cb
ccwrap.onset = ccb_set;
ccwrap.onready = ccb_ready;

            
          
!
999px

Console