how i reload animated html?

4 years ago
currently i'm using 2 wordarts in 2 different route, when i redirect(its not hard reload similar to clientside framework doing like react/angular) to second page its looking empty(no image in canvas), i need to hard refresh to draw it again then the first page become empty

is there any function available in wordart.min.js to reload if i'm changing URL?
4 years ago
Hi! There is no function in wordart.min.js to reload but you can try to change the size of the div element. It will force your word art to redraw.
4 years ago
if we adding a div with class="tagul-word-cloud" & data-tagul-src="assets/wordart.json" dynamically after some time in dom, its not picked by wordart.min.js

you are using window.addEventListener( "load", () => {} ) to draw canvas if the div with data-tagul-src="assets/wordart.json" not available in dom at initial loading & its dynamically adding after some time
Edited 07 Feb, 2020 00:41
4 years ago
Then try to add wordart.min.js after you add the div element. The script will be automatically executed even if page is loaded.
4 years ago
I think, providing a render or reload function is better to handle this from modern SPA frameworks
4 years ago
Thank you for you suggestion. We will consider it for inclusion in future versions of the software.
4 years ago
Is there any way to get notification of this functionality implementation?
4 years ago
I'll post it here. But we don't have immediate plans to implement this. Did my suggestion to add wordart.min.js after div element work?
4 years ago
yup that's working but it's not the standard way

export const reloadScriptTag = url => {
const existingScriptTag = document.querySelector(`script[src="${url}"]`);
if (existingScriptTag) existingScriptTag.remove();
const scriptTag = document.createElement("script" ) ;
document.body.appendChild(scriptTag);
scriptTag.src = url;
return scriptTag;
};
Edited 17 Feb, 2020 09:06

Reply

Sign up or Login to post a reply.