smarquee icon indicating copy to clipboard operation
smarquee copied to clipboard

Issue: Determines if marquees are needed when changing content. (1.0.5)

Open lannodev opened this issue 1 year ago • 3 comments

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.

lannodev avatar Jun 07 '23 13:06 lannodev

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();
}

tomickigrzegorz avatar Jul 14 '23 19:07 tomickigrzegorz

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

image

lannodev avatar Jul 16 '23 13:07 lannodev

Now I see you are right. Version 1.0.5 does not work properly.

tomickigrzegorz avatar Jul 17 '23 14:07 tomickigrzegorz