Is there a way to create a condition for when a script is executed? I want the script to be disabled if a window in the browser reaches 100% width and 100% height.
The script in question can be found here:
element = document.getElementById("window");
let heightPercentage = Math.round(
(element.clientHeight / window.innerHeight) * 100
);
let widthPercentage = Math.round(
(element.clientWidth / window.innerWidth) * 100
);
if (heightPercentage < 100 && widthPercentage < 100) {
makeResizable(element, 400, 225, 10);
}
function makeResizable(element, minW = 100, minH = 100, size = 20) { ...
I have attempted to implement this by changing the type of the script upon pressing a button. However, setting it to type="application/JSON" as advised in this post: , did not yield any results.