JSFiddle - React, Tailwind, and code Playground
by LuckyCat
JavaScript
$(document).ready(function() {
function scroll() {
$("html, body").animate({
scrollTop: $(document).height()
}, 1500);
}
setTimeout(scroll, 2500);
var $btnNext = $('.step-btn');
var currentStep = 0;
var $step = $('.step-item');
var totalStep = $step.length;
$btnNext.not('.submit-btn').on('click', function() {
currentStep++;
$step.hide().eq(currentStep).fadeIn();
$('body').removeClass().addClass('step' + (currentStep + 1));
scroll();
if (currentStep == totalStep - 2) {
$('.loader').addClass('animated');
setTimeout(function() {
currentStep++;
$step.hide().eq(currentStep).fadeIn();
scroll();
}, 2000);
}
});
$('.option-item').on('click', function() {
$(this).toggleClass('checked tr-selected');
});
function randomText(min, max) {
return Math.round(min - 0.5 + Math.random() * (max - min + 1));
}
$('.result-members').text(randomText(100, 160));
function scroll() {
$("html, body").animate({
scrollTop: $(document).height()
}, 1500);
}
setTimeout(scroll, 2500);
});