added condition

This commit is contained in:
Burak Civan 2022-11-14 11:59:16 +03:00
parent 15e2c71f47
commit cb1ac3e789

View File

@ -446,33 +446,35 @@ document.querySelectorAll('[data-page-title-first]').forEach((first) => {
document.querySelectorAll('[data-page-title-second]').forEach((second) => {
let title_truncate = first.querySelector('[data-title-truncate]');
if (first.clientWidth < title_truncate.clientWidth) {
// added specific width styling for truncate text
title_truncate.style.width = first.clientWidth + 'px';
let subtract = title_truncate.clientWidth - 40;
title_truncate.style.width = subtract + 'px';
title_truncate.classList.add('truncate');
// added specific width styling for truncate text
if (title_truncate !== null) {
if (first.clientWidth < title_truncate.clientWidth) {
// added specific width styling for truncate text
title_truncate.style.width = first.clientWidth + 'px';
let subtract = title_truncate.clientWidth - 40;
title_truncate.style.width = subtract + 'px';
title_truncate.classList.add('truncate');
// added specific width styling for truncate text
// added specific width styling into the parent title element for truncate text
first.classList.add('w-full', 'sm:w-6/12');
// added specific width styling into the parent title element for truncate text
// added specific width styling into the parent title element for truncate text
first.classList.add('w-full', 'sm:w-6/12');
// added specific width styling into the parent title element for truncate text
title_truncate.parentNode.classList.add('overflow-x-hidden', 'hide-scroll-bar');
title_truncate.parentNode.classList.add('overflow-x-hidden', 'hide-scroll-bar');
// added truncate animation for truncated text
title_truncate.addEventListener('mouseover', function () {
this.classList.add('animate-marquee');
this.classList.remove('truncate');
this.style.animationPlayState = 'running';
});
// added truncate animation for truncated text
title_truncate.addEventListener('mouseover', function () {
this.classList.add('animate-marquee');
this.classList.remove('truncate');
this.style.animationPlayState = 'running';
});
title_truncate.addEventListener('mouseout', function () {
this.style.animationPlayState = 'paused';
this.classList.remove('animate-marquee');
this.classList.add('truncate');
});
// added truncate animation for truncated text
title_truncate.addEventListener('mouseout', function () {
this.style.animationPlayState = 'paused';
this.classList.remove('animate-marquee');
this.classList.add('truncate');
});
// added truncate animation for truncated text
}
}
// remove width class name for extend the right side