/**
* A script library to import the javascript / css file on the fly
*
* @author Aby Dahana <abydahana@gmail.com>
* @copyright (c) Aksara Laboratory <https://aksaracms.com>
* @license MIT License
*
* This source file is subject to the MIT license that is bundled with this
* source code in the LICENSE.txt file.
*/
"use strict";
const prevScrollpos = window.pageYOffset;
/**
* Hide navbar on scroll down, restore on scroll up.
* Applied only when navigation menu has id "hide-on-scroll"
*/
window.onscroll = function() {
var currentScrollPos = window.pageYOffset,
navbar = document.getElementById('hide-on-scroll');
if (navbar && window.navigator.userAgent.indexOf('Trident/') === -1) {
if (prevScrollpos > currentScrollPos) {
navbar.style.top = 0;
navbar.nextElementSibling.style.top = 0;
} else if (currentScrollPos > navbar.offsetHeight) {
navbar.style.top = '-' + navbar.offsetHeight + 'px';
navbar.nextElementSibling.style.top = '-' + navbar.offsetHeight + 'px';
}
prevScrollpos = currentScrollPos;
}
};
$(document).ready(function()
{
$('.carousel').on('slide.bs.carousel', function (e)
{
var nextHeight = $(e.relatedTarget).height();
$(this).find('.active.carousel-item').parent().animate
({
height: nextHeight
}, 500);
});
if ($('[role=announcements]').length)
{
$('body').css
({
paddingBottom: 40
})
}
});
|