change typeof == function to $.isFunction, simplify resize