For assets used on more than one page
CardWrapper.html, CarouselContainer.html, Jumbotron.html
// Carousel - Page/Assets.html
var carousels = document.querySelectorAll('.carousel .carousel-inner .carousel-item:first-child');
if ( carousels.length ) {
carousels.forEach( carousel => {
carousel.classList.add('active');
});
}
// Fixed button on left or right browser edge - Page/Assets.html
function t3sbFixedButtons(fixedButtons, visiblePart, btnSlideOutCorrection, isBtnGroup) {
fixedButtons.forEach( fixedButton => {
if (fixedButton !== null && fixedButton !== '') {
fixedButton.style.opacity = '0';
fixedButton.classList.remove('d-none');
var button;
if ( fixedButton.classList.contains('fixedModalButton') ) {
button = fixedButton.querySelector('button');
} else {
if ( fixedButton.classList.contains('fixedGroupButton') ) {
button = fixedButton.querySelector('div');
}
if ( fixedButton.classList.contains('btn') ) {
button = fixedButton;
}
}
t3sbFadeInEffect(fixedButton);
if ( button.classList.contains('rotate-minus') || button.classList.contains('rotate-plus') ) {
let position = fixedButton.clientWidth / 2 - fixedButton.clientHeight / 2;
if ( fixedButton.classList.contains('fixedPosition-right') ) {
fixedButton.style.right = '-'+position+'px';
} else {
fixedButton.style.left = '-'+position+'px';
}
} else {
if (visiblePart) {
var slideInButtons = fixedButton.querySelector('.slideInButton');
if (slideInButtons !== null && slideInButtons !== '') {
var slideIn = 0,
slideOut = 0,
boxWidth = fixedButton.clientWidth,
boxHalfHeight = fixedButton.clientHeight / 2;
if (isBtnGroup) {
Array.from(slideInButtons.children).forEach( slideInButton => {
if ( typeof slideInButton.firstChild !== 'undefined' ) {
slideIn = boxWidth - visiblePart;
var icon = slideInButton.querySelector('i');
icon.classList.add('me-2');
slideInButton.style.width = 'auto';
slideInButton.style.right = '-'+slideIn+'px';
fixedButton.style.top = 'calc(50% - '+boxHalfHeight+'px)';
slideInButton.classList.add('mb-1', 'text-start', 'btnGroupSlider');
slideInButton.addEventListener('mouseenter', function(e) {
if(e.target.classList.contains('btn')) {
slideOut = slideInButton.clientWidth-visiblePart;
e.target.style.position = 'relative';
e.target.style.right = Math.abs(slideOut)+'px';
e.target.classList.add('btn-slide-out');
e.target.classList.remove('btn-slide-in');
}
},true);
slideInButton.addEventListener('mouseleave', function(e) {
if(e.target.classList.contains('btn')) {
e.target.style.right = 0;
e.target.classList.remove('btn-slide-out');
e.target.classList.add('btn-slide-in');
e.target.style.position = 'inherit';
}
},true);
}
});
}
}
}
}
}
});
}
function t3sbFadeInEffect(fadeTarget) {
window.setTimeout(() => {
var opacity = 0;
var interval = 50;
var duration = 400;
var gap = interval / duration;
var fading = window.setInterval(() => {
opacity = opacity + gap;
fadeTarget.style.opacity = opacity;
if (opacity <= 0) {
fadeTarget.style.visibility = 'hidden';
}
if (opacity <= 0 || opacity >= 1) {
window.clearInterval(fading);
}
}, interval);
}, 2000);
}
Button.html, Page/Assets.html
// Fixed button group on left or right browser edge - Page/Assets.html
var buttonsFixedPosition = document.querySelectorAll('.fixedPosition');
var visiblePart = {visiblePart};
var btnSlideOutCorrection = {settings.btnSlideOutCorrection};
if ( buttonsFixedPosition.length ) {
t3sbFixedButtons(buttonsFixedPosition, visiblePart, btnSlideOutCorrection, true);
}
// Fixed button on left or right browser edge - Page/Assets.html
var buttonsFixedPosition = document.querySelectorAll('.fixedPosition');
if ( buttonsFixedPosition.length ) {
t3sbFixedButtons(buttonsFixedPosition, 0, 0, false);
}
Page/Section.html, Page/MenuSection.html
// Sectionmenu scrollspy - Page/Assets.html
const sectionmenu = document.getElementById('sectionmenu');
var sidebarSectionMobile = {settings.config.sidebarSectionMobile};
var sidebarSectionMobile2222 = {settings.config.sidebarSectionMobile};
if ( !sidebarSectionMobile && window.innerWidth < {settings.config.navbarBreakpointWidth} ) {
sectionmenu.parentNode.removeChild(sectionmenu);
} else {
document.body.setAttribute('data-bs-spy', 'scroll');
document.body.setAttribute('data-bs-target', '#sectionmenu');
document.body.setAttribute('data-bs-smooth-scroll', 'true');
document.body.setAttribute('data-bs-root-margin', '{settings.config.sectionmenuScrollspyRootMargin}');
document.body.setAttribute('data-bs-threshold', '[{settings.config.sectionmenuScrollspyThreshold}]');
document.body.setAttribute('tabindex', '0');
sectionmenu.querySelectorAll('a').forEach( link => {
link.addEventListener('click', function(l) {
t3sbScrollToAnchor({settings.config.sectionmenuAnchorOffset as integer}, fixedNavbar, navbarHeight, l.currentTarget.getAttribute('href'));
});
});
}
window.onscroll = function() {stickyFunction()};
var sticky = {settings.config.sectionmenuAnchorOffset};
var maincontent = document.getElementsByClassName('main-content');
function stickyFunction() {
if (window.pageYOffset + navbarHeight >= sticky) {
sectionmenu.style.width = maincontent[0].clientWidth+'px';
sectionmenu.style.position = 'fixed';
sectionmenu.style.top = navbarHeight+'px';
} else {
sectionmenu.style.position = 'inherit';
}
}