就像标题所说,我需要一些帮助来组合两个 jQuery 函数。这看起来很简单,但我无法弄清楚。他们每个人都做同样的事情。如果有帮助,第二个函数的“updated_checkout”是 WooCommerce 回调。
$( window ).on( 'resize', function () {
// Do same thing as other function
});
jQuery( document ).on( 'updated_checkout', function () {
// Do same thing as other function
} );
最佳答案
简单为:
function doTheSameThing() {
// Do same thing
}
$( window ).on( 'resize', doTheSameThing);
jQuery( document ).on( 'updated_checkout', doTheSameThing);
关于javascript - 需要组合 jQuery 函数的帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50106890/