smarquee
smarquee copied to clipboard
Issue: Determines if marquees are needed when changing content. (1.0.5)
Thank you for you package. I found a problem with the last version 1.0.5 In your example, change the package version to 1.0.5 and try to select a small text like "Face : Face". This is what's happening: https://github.com/BuddyLReno/smarquee/assets/12519008/819acf61-15e1-444d-8c78-aa106911c77c
The other problem is on delay property, On init constructor I have set to 3seconds but if I change the text the value of delay is override by default value.
The question is do you need animation when there is small text. In my case, I didn't, so I checked if the text is overflow, if so, then I run the function.
const smarqueeElement = document.querySelector("#smarquee");
function checkIfElementIsOverflow(el) {
const overflowElement = el.style.overflow;
if (!overflowElement || overflowElement === "visible") {
el.style.overflow = "hidden";
}
const isOverflowing = el.clientWidth < el.scrollWidth || el.clientHeight < el.scrollHeight;
el.style.overflow = overflowElement;
return isOverflowing;
}
if (checkIfElementIsOverflow(smarqueeElement)) {
smarquee.init();
}
I don't need it when the text is small. But in version 1.0.5 it is animating. Using your demo, change the version to 1.0.5, you will see the problem
Now I see you are right. Version 1.0.5 does not work properly.