Best practice is to attach to the resize event.
window.addEventListener('resize', function(event) {
...
}, true);
jQuery is just wrapping the standard resize
DOM event, eg.
window.onresize = function(event) {
...
};
jQuery may do some work to ensure that the resize event gets fired consistently in all browsers, but I'm not sure if any of the browsers differ, but I'd encourage you to test in Firefox, Safari, and IE.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…