简体   繁体   中英

How to unload a script when a button is clicked?

So on my website, I integrated a plugin called manychat. This is implemented by a <script> ;

When I click on the Drawer Cart this manychat symbol overlays over the checkout button, which doesn't look nice.

So when I click the "cart" button it should unload this script. With the next action, it should then be loaded again.

Is this possible?

I am using Shopify

<script src="//widget.manychat.com/1541935499435047.js" async="async"></script>

You can't unload a script once loaded. You can, however, dig deep in to the script and cancel out the global variables it create - and undo what it does to your DOM such as any event listeners it might have registered.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM