blog
- 11 Similarities and Differences between Cryptocurrency and Fiat Currency - The proliferation of cryptocurrency in todayâs world has speculated much discussion about how it will replace conventional fiat currency. Due to the increasing usage of cashless transactions, cryptocurrency organisations are ever-adapting to meet the needs of an ideal future - A safe and secure, highly efficient and responsive, cashless society. People prefer to make payments […]
';
document.querySelector('body').lastElementChild.insertAdjacentHTML('afterend', scrollIndiTemplate);
const scrollIndiController = document.querySelector('.scroll-indicator-controller');
if ((typeof window.orientation !== "undefined") || (navigator.userAgent.indexOf('IEMobile') !== -1)) { scrollIndiController.classList.add('indi-mobile'); }
const scrollIndiElems = Array.prototype.slice.call(scrollIndi);
scrollIndiElems.forEach(function (e, i) {
const scrollIndiId = e.getAttribute('id');
const scrollIndiTitle = e.getAttribute('data-scroll-indicator-title');
let firstActiveClass = '';
if (i == 0) {
firstActiveClass = 'active';
}
scrollIndiController.lastElementChild.insertAdjacentHTML('afterend', '');
});
const scrollIndiControllerDots = scrollIndiController.querySelectorAll('[data-indi-controller-id]');
var handleIndiScroll = dotsThrottle(function () {
let indiScrollTopCollection = {};
scrollIndiElems.forEach(function (e) {
const scrollIndiIdScroll = e.getAttribute('id');
const indiScrollTop = e.getBoundingClientRect().top;
indiScrollTopCollection[scrollIndiIdScroll] = indiScrollTop;
});
// const indiOffsetValues = Object.values(indiScrollTopCollection); not supported in ie
const indiOffsetValues = Object.keys(indiScrollTopCollection).map(function (itm) { return indiScrollTopCollection[itm]; });
const indiOffsetMin = function () {
const indiRemoveMinuses = indiOffsetValues.filter(function (x) { return x > -150; });
return Math.min.apply(null, indiRemoveMinuses);
};
Object.keys(indiScrollTopCollection).forEach(function (e) {
if (indiScrollTopCollection[e] == indiOffsetMin()) {
Array.prototype.forEach.call(scrollIndiControllerDots, function (el) {
if (el.classList.contains('active')) {
el.classList.remove('active');
}
});
scrollIndiController.querySelector('[data-indi-controller-id="' + e + '"]').classList.add('active');
}
});
}, 300);
window.onscroll = function() {
handleIndiScroll();
};
}
}
function scrollIndiClicked(indiId) {
if (window.jQuery) {
// if jquery is availble then we can use jquery animations
if (dotFixedNavPresent === true && dotFixedNavId.length) {
// there is a fixed nav and its id has been defined
const dotNavHeightElem = document.getElementById(dotFixedNavId);
const dotNavHeight = dotNavHeightElem.clientHeight;
const dotDocumentHtml = $('html, body');
const indiElement = $('#' + indiId);
if (dotFixedNavUp === true) {
// fix nav on upward scroll only
dotDocumentHtml.animate({
scrollTop: indiElement.offset().top
}, 700);
const scrollPos = document.body.getBoundingClientRect().top;
setTimeout(function () {
if (document.body.getBoundingClientRect().top > scrollPos) {
dotDocumentHtml.animate({
scrollTop: indiElement.offset().top - dotNavHeight
}, 400);
}
}, 400);
}
else {
// fixed nav scroll
dotDocumentHtml.animate({
scrollTop: indiElement.offset().top - dotNavHeight
}, 700);
}
}
else {
// normal scroll
$('html, body').animate({
scrollTop: $('#' + indiId).offset().top
}, 700);
}
}
else {
// there is no jquery so we use vanilla scroll animations
if (dotFixedNavPresent === true && dotFixedNavId.length) {
// there is a fixed nav and its id has been defined
const dotNavHeightElem = document.getElementById(dotFixedNavId);
const dotNavHeight = dotNavHeightElem.clientHeight;
const indiElement = document.getElementById(indiId);
if (dotFixedNavUp === true) {
// fix nav on upward scroll only
window.scrollTo({
top: indiElement.offsetTop,
left: 0,
behavior: 'smooth'
});
const scrollPos = document.body.getBoundingClientRect().top;
setTimeout(function () {
if (document.body.getBoundingClientRect().top > scrollPos) {
window.scrollTo({
top: indiElement.offsetTop - dotNavHeight,
left: 0,
behavior: 'smooth'
});
}
}, 400);
}
else {
// fixed nav scroll
window.scrollTo({
top: indiElement.offsetTop - dotNavHeight,
left: 0,
behavior: 'smooth'
});
}
}
else {
// normal scroll
window.scrollTo({
top: document.getElementById(indiId).offsetTop,
left: 0,
behavior: 'smooth'
});
}
}
}
// Init
easyScrollDots({
'fixedNav': false,
'fixedNavId': '',
'fixedNavUpward': false
});
$(document).foundation();
$(window).scroll(function(){
if ($(window).scrollTop() >= 50) {
$('header').addClass('fixed');
}
else {
$('header').removeClass('fixed');
}
});
$('.mobi_menu').click(function(){
$('header nav').toggleClass('act');
$(this).toggleClass('act');
});