diff --git a/boday_it/static/js/base.js b/boday_it/static/js/base.js index c6d36ba..f19fee3 100644 --- a/boday_it/static/js/base.js +++ b/boday_it/static/js/base.js @@ -16,23 +16,35 @@ var Cl = window.Cl || {}; // ############################################################################# // BASE // istanbul ignore next -(function ($) { - 'use strict'; +(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(); - } + // 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' - }); + // 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) { + backTop.style.opacity = +(bodyContainer.offsetTop + bodyContainer.getBoundingClientRect().height > window.innerHeight); } - }); + }; + $(window).resize(shBackTop); + $(window).scroll(shBackTop); + shBackTop(); + + }); })(jQuery);