Pangloss Pangloss - 3 months ago 15
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!


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