PDA

View Full Version : Windows Maximize and Minimize event of a browser in IE



rajuarien
17 Sep 2013, 7:03 AM
How to capture Windows Maximize and Minimize event of a browser in IE using EXTJS 3.4.

--This works
Ext.EventManager.onWindowResize(function () {
console.log('windows resized');
}

--This doesnt work
Ext.EventManager.on(window, 'maximize', function () {
console.log('maximized.....');
});
--This doesnt work
Ext.EventManager.on(window, 'minimize', function () {
console.log('minimize.....');
});

willigogs
18 Sep 2013, 3:04 AM
It depends what you're trying to achieve.

The "onWindowResize" is actually tracking when the BROWSER window is resized - not an Ext Window.

If you're wanting to track when an Ext window is maximised or minimised, then you could simply hook into the Ext Window's events. For example:


var win = new Ext.Window({
// CONFIG OPTIONS GO HERE
listeners: {
minimise: function() {
console.log('Window has been minimised')
},
maximise: function() {
console.log('Window has been maximised')
}
}
});


If you're wanting to track the actual browser window behaviour, then that will be more difficult, and is not tracked by ExtJS as far as I know.

A quick Google search throws up some examples where people are hooking into the window's blur and focus events (but that is only returning if the window is "active" or not), and other examples seem to be using the window.screenX value - but I'm not sure if these methods are reliable.

rajuarien
18 Sep 2013, 5:43 AM
Thanks. I need to trap the maximise of the browser window

rajuarien
19 Sep 2013, 1:36 PM
Worked around the same

Ext.EventManager.onWindowResize(function () {

if (window.screenLeft == 0) //windows maximised