このjqueryコードがありますが、デフォルトの動作を設定できません。デフォルトの命令はどこ (つまり、コード内の場所) に記述できますか? 後戻り this.each または before or where? 答えてくれてありがとう。
// corners v2
$.fn.corners2 = function (options) {
// defaults settings for corners2
var defaults = {
// corners default style
corners: 'default',
// corners default radius
border_radius: '1',
// borders default style
border_style: 'solid',
// borders default color without # symbol
border_color: '#f7145a'
};
// options
var options = $.extend({}, defaults, options);
return this.each(function () {
var element = $(this);
// corners
switch (options.corners) {
// all
case 'all':
element.css({
'-webkit-border-radius': '' + options.radius + 'px',
'-moz-border-radius': '' + options.radius + 'px',
'border-radius': '' + options.radius + 'px'
});
break;
// top left
case 'top-left':
element.css({
'-webkit-border-top-left-radius': '' + options.radius + 'px',
'-moz-border-radius-topleft': '' + options.radius + 'px',
'border-top-left-radius': '' + options.radius + 'px'
});
break;
// top right
case 'top-right':
element.css({
'-webkit-border-top-right-radius': '' + options.radius + 'px',
'-moz-border-radius-topright': '' + options.radius + 'px',
'border-top-right-radius': '' + options.radius + 'px'
});
break;
}
});
};
}(jQuery));