show "back to top" only when needed
This commit is contained in:
parent
6162b3fcae
commit
b30754a243
1 changed files with 27 additions and 15 deletions
|
|
@ -16,23 +16,35 @@ var Cl = window.Cl || {};
|
||||||
// #############################################################################
|
// #############################################################################
|
||||||
// BASE
|
// BASE
|
||||||
// istanbul ignore next
|
// istanbul ignore next
|
||||||
(function ($) {
|
(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// shorthand for invoking jQuery(document).ready
|
// shorthand for invoking jQuery(document).ready
|
||||||
$(function () {
|
$(function() {
|
||||||
// removes noscript form body and adds print-js
|
// removes noscript form body and adds print-js
|
||||||
if (window.Cl && window.Cl.Utils) {
|
if (window.Cl && window.Cl.Utils) {
|
||||||
Cl.Utils._document();
|
Cl.Utils._document();
|
||||||
}
|
}
|
||||||
|
|
||||||
// DOCS: https://github.com/burocratik/outdated-browser
|
// DOCS: https://github.com/burocratik/outdated-browser
|
||||||
if (window.outdatedBrowser) {
|
if (window.outdatedBrowser) {
|
||||||
outdatedBrowser({
|
outdatedBrowser({
|
||||||
'languagePath': '',
|
'languagePath': '',
|
||||||
'lowerThan': 'boxShadow'
|
'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);
|
})(jQuery);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue