Fixed bug when the canvas has width and height equal to zero, using jquery to get the width and height instead of native methods.