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!');
};
Aucun commentaire:
Enregistrer un commentaire