Created
April 19, 2023 20:03
-
-
Save groksrc/b5af7c8cf879b204f6df4e73c4f21892 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Function to set the width and height of the element | |
function setElementSize(element) { | |
element.style.width = '47px'; | |
element.style.height = '47px'; | |
} | |
// Function to check for the element's existence and set its size | |
function checkForElement() { | |
const chatWidget = document.querySelector('chat-widget'); | |
if (chatWidget && chatWidget.shadowRoot) { | |
const element = chatWidget.shadowRoot.querySelector('#lc_text-widget--btn'); | |
if (element) { | |
setElementSize(element); | |
clearInterval(intervalId); // Stop checking once the element is found and resized | |
} | |
} | |
} | |
// Start checking for the element every 100 milliseconds | |
const intervalId = setInterval(checkForElement, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment