Следующий код будет создать плагин с методамиКак создать плагин с классом?
(function ($) {
$.fn.greenify = function(options) {
// This is the easiest way to have default options.
var settings = $.extend({
// These are the defaults.
color: "#556b2f",
backgroundColor: "white"
}, options);
// Greenify the collection based on the settings variable.
return this.css({
color: settings.color,
backgroundColor: settings.backgroundColor
});
};
}(jQuery));
И мы можем использовать так:
$("div").greenify({
color: "orange"
});
Но я хочу знать, что-то вроде этого
<div class="pluginclass"></div>
А потом это должен быть в соответствии с плагином, который просто использует класс в разметке, но не такой, как $('div').pluginclass();
спасибо ...................... –