0

I am working on a website at the moment where I do not have access to edit the page template. Within this template, the following jQuery is used to refresh the page when resized:

var lastWindowWidth = $(window).width();
$(window).resize(function () {
    setTimeout(function () {
        if ($(window).width() !== lastWindowWidth) {
            window.location.href = window.location.href;
        }
    }, 200);
});

Is there any way I can turn this off or overwrite using JavaScript or jQuery?

  • You can't remove anonymous event listeners from an element – Luca Kiebel Sep 10 '18 at 08:24
  • Possible duplicate of [Javascript/DOM: How to remove all events of a DOM object?](https://stackoverflow.com/questions/4386300/javascript-dom-how-to-remove-all-events-of-a-dom-object) – Luca Kiebel Sep 10 '18 at 08:25

1 Answers1

0

I think it could be

$(window).off("resize");

This shows that resize can be configured with off https://api.jquery.com/resize/

http://api.jquery.com/off/