boday_tf/boday_it/static/js/base.js
2020-02-03 22:52:01 +01:00

56 lines
1.6 KiB
JavaScript

/*
* Copyright (c) 2013, Divio AG
* Licensed under BSD
* http://github.com/aldryn/aldryn-boilerplate-bootstrap3
*/
// #############################################################################
// NAMESPACES
/**
* @module Cl
*/
// istanbul ignore next
var Cl = window.Cl || {};
/* global outdatedBrowser */
// #############################################################################
// BASE
// istanbul ignore next
(function($) {
'use strict';
// shorthand for invoking jQuery(document).ready
$(function() {
// removes noscript form body and adds print-js
if (window.Cl && window.Cl.Utils) {
Cl.Utils._document();
}
// DOCS: https://github.com/burocratik/outdated-browser
if (window.outdatedBrowser) {
outdatedBrowser({
'languagePath': '',
'lowerThan': 'boxShadow'
});
}
// custom functions "botsicode"
const backTop = document.querySelector('.list-inline .pull-right'),
bodyContainer = document.querySelector('body>div.container'),
shBackTop = function() {
if (backTop && bodyContainer) {
if (bodyContainer.offsetTop + bodyContainer.getBoundingClientRect().height > window.innerHeight) {
if (backTop.classList.contains('back-top--hidden')) {
backTop.classList.remove('back-top--hidden');
}
} else if (!backTop.classList.contains('back-top--hidden')) {
backTop.classList.add('back-top--hidden');
}
}
};
$(window).resize(shBackTop);
$(window).scroll(shBackTop);
shBackTop();
});
})(jQuery);