javascript - Switch between .bind() and .on() - dynamically -
i want this, because working third-party scripts releated internet marketing. of them may contain jquery library included within , interfere recent or latest jquery library included on website. hence, i'd switch between .on() , .bind() dynamically upon website load of variable. for example, let's have global variable: var incjs = false; and depending of third-party script, know if have older lib included i'd use this. function tpnetwork () { incjs = true; startgateway('xxxxx'); $('#fancybox-outer') .delay(1000) .fadeto(300, 1); preventgtw(); widgetstyle(); } now may see there's function @ bottom widgetstyle() that function contain loads of things, important part following: $(window).on('resize', function () { if ($('.widget_wrap').length) widgetcenter_horizontal(); }); it has .on() method there. not supported in old jquery that's been used third-party network. i'd sw