127
rated 0 times
[
129]
[
2]
/ answers: 1 / hits: 26576
/ 8 Years ago, tue, august 30, 2016, 12:00:00
I'm trying to trigger resize event using plain js for testing purpose, but window.resizeTo()
and window.resizeBy()
don't trigger the event according to the modern browsers prevent these actions. I tried jquery $(window).trigger('resize');
but it works only for events that attached via jquery like $(window).on('resize', handler);
. however in my case the project I am working on uses plain javascript.
example
window.addEventListener('resize', function(){
console.log('window has been resized !');
});
// or even using global onresize
window.onresize = function() {
console.log('window has been resized!');
};
More From » testing