Silverton
Aggregate Calculator
Please note: This online calculator is for guidance only and quantities should always be checked with our sales team before placing an order with us.
Select your aggregate...
Single sized aggregate
Sharp Sand
Building sand
Washed shingle
Type 1 Granite (primary)
Type 1 Silverblend
Type 1 (recycled)
Ballast
const aggregateCalculator = {
init(el, opts) {
if (!el) {
console.error('Calculator element not found');
return;
}
this.typeSelect = el.querySelector('[data-calc-type]');
this.widthInput = el.querySelector('[data-calc-width]');
this.lengthInput = el.querySelector('[data-calc-length]');
this.depthInput = el.querySelector('[data-calc-depth]');
this.resultField = el.querySelector('[data-calc-result]');
if (!this.typeSelect || !this.widthInput || !this.lengthInput || !this.depthInput || !this.resultField) {
console.error('Required UI controls were not found');
return;
}
this.addListeners();
},
addListeners() {
this.typeSelect.addEventListener('input', this.calculate.bind(this));
this.widthInput.addEventListener('input', this.calculate.bind(this));
this.lengthInput.addEventListener('input', this.calculate.bind(this));
this.depthInput.addEventListener('input', this.calculate.bind(this));
},
calculate() {
const modifier = parseFloat(this.typeSelect.value);
if (!modifier) {
return;
}
const w = this.widthInput.value,
l = this.lengthInput.value,
d = this.depthInput.value/1000;
const mass = (w * l * d) * modifier;
const massResult = Math.round((mass + Number.EPSILON) * 100) / 100;
if (mass > 0) {
this.resultField.textContent = `${massResult} metric tonnes required`;
}
},
};
document.querySelectorAll('[data-aggregate-calculator]').forEach((el) => {
const calc = aggregateCalculator.init(el);
});
