boday_tf/boday_it/static/js/base.js

57 lines
1.6 KiB
JavaScript
Raw Normal View History

2020-01-27 17:38:52 +00:00
/*
* 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
2020-02-03 20:26:34 +00:00
(function($) {
'use strict';
2020-01-27 17:38:52 +00:00
2020-02-03 20:26:34 +00:00
// shorthand for invoking jQuery(document).ready
$(function() {
// removes noscript form body and adds print-js
if (window.Cl && window.Cl.Utils) {
Cl.Utils._document();
}
2020-01-27 17:38:52 +00:00
2020-02-03 20:26:34 +00:00
// 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) {
2020-02-03 21:52:01 +00:00
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');
}
2020-01-27 17:38:52 +00:00
}
2020-02-03 20:26:34 +00:00
};
$(window).resize(shBackTop);
$(window).scroll(shBackTop);
shBackTop();
});
2020-01-27 17:38:52 +00:00
})(jQuery);