User Testing Demo App
User Testing Demo App for VGS Collect.js v2.0
by VeryGoodFiddle
HTML
<div class='container'>
<div class='window'>
<div class='order-info'>
<div class='order-info-content'>
<h2>Order Summary</h2>
<div class='line'></div>
<table class='order-table'>
<tbody>
<tr>
<td><img src='https://dl.dropboxusercontent.com/s/sim84r2xfedj99n/%24_32.JPG' class='full-width' />
</td>
<td>
<br> <span class='thin'>Nike</span>
<br> Free Run 3.0 Women<br> <span class='thin small'> Color: Grey/Orange, Size: 10.5<br><br></span>
</td>
</tr>
<tr>
<td>
<div class='price'>$99.95</div>
</td>
</tr>
</tbody>
</table>
<div class='line'></div>
<table class='order-table'>
<tbody>
<tr>
<td><img src='https://dl.dropboxusercontent.com/s/qbj9tsbvthqq72c/Vintage-20L-Backpack-by-Fj%C3%A4llr%C3%A4ven.jpg' class='full-width' />
</td>
<td>
<br> <span class='thin'>Fjällräven</span>
<br>Vintage Backpack<br> <span class='thin small'> Color: Olive, Size: 20L</span>
</td>
</tr>
<tr>
<td>
<div class='price'>$235.95</div>
</td>
</tr>
</tbody>
</table>
<div class='line'></div>
<table class='order-table'>
<tbody>
<tr>
<td><img src='https://dl.dropboxusercontent.com/s/nbr4koso8dpoggs/6136C1p5FjL._SL1500_.jpg' class='full-width' />
</td>
<td>
<br> <span class='thin'>Monobento</span>
<br>Double Lunchbox<br> <span class='thin small'> Color: Pink, Size: Medium</span>
</td>
</tr>
<tr>
<td>
<div class='price'>$25.95</div>
</td>
...
CSS
@import url(https://fonts.googleapis.com/css?family=Lato:400,300,700);
body,
html {
height: 100%;
margin: 0;
font-family: lato;
}
h2 {
margin-bottom: 0px;
margin-top: 25px;
text-align: center;
font-weight: 200;
font-size: 19px;
font-size: 1.2rem;
}
.container {
height: 100%;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
background: -webkit-linear-gradient(#c5e5e5, #ccddf9);
background: linear-gradient(#c9e5e9, #ccddf9);
}
.dropdown-select.visible {
display: block;
}
.dropdown {
position: relative;
}
ul {
margin: 0;
padding: 0;
}
ul li {
list-style: none;
padding-left: 10px;
cursor: pointer;
}
ul li:hover {
background: rgba(255, 255, 255, 0.1);
}
.dropdown-select {
position: absolute;
background: #77aaee;
text-align: left;
box-shadow: 0px 3px 5px 0px rgba(0, 0, 0, 0.1);
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
width: 90%;
left: 2px;
line-height: 2em;
margin-top: 2px;
box-sizing: border-box;
}
.thin {
font-weight: 400;
}
.small {
font-size: 12px;
font-size: .8rem;
}
.half-input-table {
border-collapse: collapse;
width: 100%;
}
.half-input-table td:first-of-type {
border-right: 10px solid #4488dd;
width: 50%;
}
.window {
height: 540px;
width: 800px;
background: #fff;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
border-radius: 30px;
z-index: 10;
}
.order-info {
height: 100%;
width: 50%;
padding-left: 25px;
padding-right: 25px;
box-sizing: border-box;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
...
JavaScript
const f = VGSCollect.create('tntq4dwvhri', function(state) {});
const css = {
'box-sizing': 'border-box',
'line-height': '1.5em',
'font-size': '18px',
'border': 'none',
'padding': '5px 10px 5px 10px',
'color': '#fff',
'width': '100%',
'height': '100%',
}
f.field('#cc-name .fake-input', {
type: 'text',
name: 'card-name',
validations: ['required'],
autoComplete: 'cc-name',
css: css,
});
f.field('#cc-number .fake-input', {
elementId: 'cc-number-field',
type: 'card-number',
name: 'card-number',
validations: ['required', 'validCardNumber'],
autoComplete: 'cc-number',
css: css,
});
f.field('#cc-cvc .fake-input', {
elementId: 'cc-cvc-field',
type: 'card-security-code',
name: 'card-cvc',
validations: ['required', 'validCardSecurityCode'],
autoComplete: 'cc-csc',
css: css,
});
f.field('#cc-expiration-date .fake-input', {
elementId: 'cc-expiration-date-field',
type: 'card-expiration-date',
name: 'card-expirationDate',
validations: ['required', 'validCardExpirationDate'],
autoComplete: 'cc-exp',
css: css,
serializers: [{ name: "replace", options: { old:" / ", new: "/" }}],
});
document.querySelectorAll('label').forEach((el) => {
el.addEventListener('click', (t) => {
field.focus();
});
})
document.getElementById('form_live').addEventListener('submit', function(e) {
e.preventDefault();
f.submit('/post', {}, function(status, data) {
document.getElementById('message').innerText = 'Request was submitted successfully!';
});
}, false);