Javascript 需要帮助组合jQuery函数吗
正如标题所说,我需要一些帮助来组合两个jQuery函数。看起来很简单,但我搞不懂。他们每个人都做同样的事情。如果有帮助,第二个函数的“updated_checkout”是一个回调函数Javascript 需要帮助组合jQuery函数吗,javascript,jquery,woocommerce,Javascript,Jquery,Woocommerce,正如标题所说,我需要一些帮助来组合两个jQuery函数。看起来很简单,但我搞不懂。他们每个人都做同样的事情。如果有帮助,第二个函数的“updated_checkout”是一个回调函数 $( window ).on( 'resize', function () { // Do same thing as other function }); jQuery( document ).on( 'updated_checkout', function () { // Do same
$( 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);
简单到:
function doTheSameThing() {
// Do same thing
}
$( window ).on( 'resize', doTheSameThing);
jQuery( document ).on( 'updated_checkout', doTheSameThing);