I'd like to know if is possibile in a jquery plugin define a variable options that contain other variables or functions
$.fn.Plugin.defaults = {
pagelabels: "Page " + current + " of " + totalPages;
total: "The total is " + getTotal.call(this);
};
$.fn.Plugin = function(options) {
var options = $.extend(true, {}, $.fn.Plugin.defaults, options);
return this.each(function() {
var current = 10;
var totalPages = 100;
$('#page').text(options.pagelabels);
$('#total').text(options.total);
});
};
function getTotal() {
return 2000;
}
Is there a way to do this? Thank you
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire