Thursday, 9 February 2017

Extend default Jquery function

No comments
For Example to resize canvas

(function($) {
$.fn.extend({
//Let the user resize the canvas to the size he/she wants
resizeCanvas:  function(w, h) {
var c = $(this)[0]
c.width = w;
c.height = h
}
})
})(jQuery)

$("#canvas").resizeCanvas(434, 434)



<canvas id="canvas">
</canvas>