Pangloss Pangloss - 1 year ago 187
Javascript Question

jQuery combine .ready and .resize functions

As the title says, I have exactly the same code needs to run in both functions. Is there a way to put them together and run as one function please? Thanks!

Answer Source

Yes. Simply define a function with the common code and pass that as the argument to the two methods.

var callback = function () {
  // This is the common code

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download