<script>
$('.next-tab').on('click', function(e) {
let self = this;
let tabsLength = $(".subOptions li").length;
e.stopPropagation()
$('.subOptions li').each(function() {
this.classList.value = '';
if(this.getAttribute('data-index') == (+self.getAttribute('data-index')+1)) {
this.classList.value = 'active';
}
})
$('.icon-plus-vertical_line > span > div')[0].setAttribute('style', `height: ${(+self.getAttribute("data-index")+1)*40}px`)
$('.accordion-container > div > div').each(function() {
this.setAttribute('class', 'accordion-tab');
this.parentElement.closest('div').classList.value = ""
if (this.getAttribute('data-index') == (+self.getAttribute('data-index')+1)) {
this.classList.value = 'accordion-tab active';
this.parentElement.closest('div').classList.value = "accordion-wrapper-activated";
if((+self.getAttribute('data-index')+1) == 1 ) {
$('.accordion-content-footer > p > a:first-child').css('visibility','hidden');
}
else {
$('.accordion-content-footer > p > a:first-child').css('visibility','visible');
}
if((+self.getAttribute('data-index')+1) == tabsLength ) {
$('.accordion-content-footer > p > a:last-child').css('visibility','hidden');
}
else {
$('.accordion-content-footer > p > a:last-child').css('visibility','visible');
}
}
})
e.preventDefault()
})
$('.previous-tab').on('click', function(e) {
let self = this;
let tabsLength = $(".subOptions li").length;
e.stopPropagation()
$('.subOptions li').each(function() {
this.classList.value = '';
if(this.getAttribute('data-index') == (+self.getAttribute('data-index')-1)) {
this.classList.value = 'active';
}
})
$('.icon-plus-vertical_line > span > div')[0].setAttribute('style', `height: ${(+self.getAttribute("data-index")-1)*40}px`)
$('.accordion-container > div > div').each(function() {
this.setAttribute('class', 'accordion-tab');
this.parentElement.closest('div').classList.value = ""
if (this.getAttribute('data-index') == (+self.getAttribute('data-index')-1)) {
this.classList.value = 'accordion-tab active';
this.parentElement.closest('div').classList.value = "accordion-wrapper-activated";
if((+self.getAttribute('data-index')-1) == 1 ) {
$('.accordion-content-footer > p > a:first-child').css('visibility','hidden');
}
else {
$('.accordion-content-footer > p > a:first-child').css('visibility','visible');
}
if((+self.getAttribute('data-index')-1) == tabsLength ) {
$('.accordion-content-footer > p > a:last-child').css('visibility','hidden');
}
else {
$('.accordion-content-footer > p > a:last-child').css('visibility','visible');
}
}
})
e.preventDefault()
})
$('.subOptions li').on('click', function(e) {
e.stopPropagation();
let self = this;
let tabsLength = $(".subOptions li").length;
if (self.classList.value === 'active') {
$('.icon-plus-vertical_line > span > div')[0].setAttribute('style', `height: 0px`)
self.classList.value = ''
$('.accordion-container > div > div').each(function() {
this.setAttribute('class', 'accordion-tab');
this.parentElement.closest('div').classList.value = ""
})
} else {
$('.subOptions li').each(function() {
this.classList.value = '';
})
$('.icon-plus-vertical_line > span > div')[0].setAttribute('style', `height: ${+self.getAttribute("data-index")*40}px`)
$('.accordion-container > div > div').each(function() {
this.setAttribute('class', 'accordion-tab');
this.parentElement.closest('div').classList.value = ""
if (this.getAttribute('data-index') === self.getAttribute('data-index')) {
this.classList.value = 'accordion-tab active';
self.classList.value = 'active';
this.parentElement.closest('div').classList.value = "accordion-wrapper-activated";
if(self.getAttribute('data-index') == 1 ) {
$('.accordion-content-footer > p > a:first-child').css('visibility','hidden');
}
else {
$('.accordion-content-footer > p > a:first-child').css('visibility','visible');
}
if(self.getAttribute('data-index') == tabsLength ) {
$('.accordion-content-footer > p > a:last-child').css('visibility','hidden');
}
else {
$('.accordion-content-footer > p > a:last-child').css('visibility','visible');
}
}
})
}
e.preventDefault();
})
$('.accordion-container > div > div').on('click', function(e) {
e.stopPropagation();
let self = this;
if( e.currentTarget.classList.value === 'accordion-tab active') {
e.currentTarget.classList.value = 'accordion-tab';
e.currentTarget.parentElement.closest('div').classList.value = '';
$('.subOptions li').each(function(){
this.classList.value = '';
if(this.getAttribute('data-index') === self.getAttribute('data-index')) {
this.classList.value = '';
}
})
$('.icon-plus-vertical_line > span > div')[0].setAttribute('style', `height: 0px;`);
} else {
let tabsLength = $(".subOptions li").length;
$('.accordion-container > div > div').each(function() {
this.setAttribute('class', 'accordion-tab');
this.parentElement.closest('div').classList.value = ""
})
self.classList.value = 'accordion-tab active';
$('.subOptions li').each(function(){
this.classList.value = '';
if(this.getAttribute('data-index') === self.getAttribute('data-index')) {
this.classList.value = 'active';
}
})
$('.icon-plus-vertical_line > span > div')[0].setAttribute('style', `height: ${+this.getAttribute("data-index")*40}px`);
this.parentElement.closest('div').classList.value = "accordion-wrapper-activated"
if(self.getAttribute('data-index') == 1 ) {
$('.accordion-content-footer > p > a:first-child').css('visibility','hidden');
}
else {
$('.accordion-content-footer > p > a:first-child').css('visibility','visible');
}
if(self.getAttribute('data-index') == tabsLength ) {
$('.accordion-content-footer > p > a:last-child').css('visibility','hidden');
}
else {
$('.accordion-content-footer > p > a:last-child').css('visibility','visible');
}
}
e.preventDefault();
})
function checkOffset() {
if($('#guidance_navigation').offset().top + $('#guidance_navigation').height()
>= $('#footer-main').offset().top - 1) {
$('#guidance_navigation').addClass('sticky-fixed')
}
if($(document).scrollTop() + window.innerHeight < $('#footer-main').offset().top)
$('#guidance_navigation').removeClass('sticky-fixed');
}
$(document).scroll(function() {
checkOffset();
});
</script> |