简体   繁体   中英

Difference Between window.resize() and window.on('resize') in jquery

window.resize()window.on('resize' , function())在jquery中有什么区别?

From jQuery page .resize():

This method is a shortcut for .on('resize', handler).

and .on() is:

The .on() method attaches event handlers to the currently selected set of elements in the jQuery object. As of jQuery 1.7, the .on() method provides all functionality required for attaching event handlers. For help in converting from older jQuery event methods, see .bind(), .delegate(), and .live().

So based on jQuery api description, I think there is no difference it's just a shortcut similar to $.click() and others

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM