I have a boilerplate something like this,and wanna reach the some function inside of this plugin.
;
(function ($, window, document, undefined) {
'use strict';
var old = $.fn.twbsPagination;
// PROTOTYPE AND CONSTRUCTOR
var TwbsPagination = function (element, options) {
this.$element = $(element);
this.options = $.extend({}, $.fn.twbsPagination.defaults, options);
return this;
};
TwbsPagination.prototype = {
constructor: TwbsPagination,
destroy: function () {
return this;
},
show: function (page) {
return this;
},
getoptions: function () {
console.log("run thıs function");
//return options;
}
};
// PLUGIN DEFINITION
$.fn.twbsPagination = function (option) {
var args = Array.prototype.slice.call(arguments, 1);
var methodReturn;
var $this = $(this);
var data = $this.data('twbs-pagination');
var options = typeof option === 'object' && option;
if (!data) $this.data('twbs-pagination', (data = new TwbsPagination(this, options)));
if (typeof option === 'string') methodReturn = data[option].apply(data, args);
return (methodReturn === undefined) ? $this : methodReturn;
};
$.fn.twbsPagination.defaults = {
};
$.fn.twbsPagination.Constructor = TwbsPagination;
$.fn.twbsPagination.noConflict = function () {
$.fn.twbsPagination = old;
return this;
};
})(jQuery, window, document);
my question how can I reach the get option function outside the plugin or how to modify plugin to do this . something like this.
var pager = $('#pagination-demo').twbsPagination({
totalPages: 35,
visiblePages: 7
});
pager.prototype.getoptions());
You have to write this:
Below this:
Q: but how can I reach the options and return options from $.fn.getoptions,when I try this it says me undefined
You can access it like this:
Will return "width is: 100"