问题
Once I've executed window.stop()
, how can I resume default actions?
I need to make toggle/switch function, that once fired will run window.stop()
, and with second run will recover window actions disabled by window.stop()
.
回答1:
I misunderstood before how window.stop() works.
I was wrong, there are no any "direct inbuilt" javascript method to reload ONLY THESE ELEMENTS stopped by window.stop(), so by this meaning it's impossible.
However, if it's needed, we can:
- loop through each element on the site by our own function
- cut website in sections, and load them one by one with ajax, so we will have to reload only specific sections --but I think either one of these it's too complex to implement to be worthy
So, to "pause website for moment" window.stop() it's not good choice.
来源:https://stackoverflow.com/questions/18935242/what-is-the-opposite-of-javascript-window-stop