Home > Web Front-end > JS Tutorial > body text

jquery plug-in learning (6)_jquery

WBOY
Release: 2016-05-16 17:50:59
Original
1221 people have browsed it
Copy code The code is as follows:

;(function($){
$.extend($ .fn,{
color : function(options){
var options = $.extend({},$.fn.color.defaults,options);
return this.each(function(){
$(this).css("color",options.bcolor);
$(this).css("background",options.fcolor);
});
}// color==end
})
$.fn.color.defaults ={bcolor :"white",fcolor :"black"}

})(jQuery);

Copy code The code is as follows:

$.fn.color.defaults ={bcolor: "#c06",fcolor:"red"}//Write your own parameters and set the color
$('h1').color();
$('p').color({bcolor:" #fff"});//Repeatedly cover the north background color to white, and set the font by default

The above calls are either written outside or inside (). Have you learned it? ? That’s it for the detailed description of the parameters in this section. Welcome to my little learning world. I searched for plug-ins online and found them everywhere, but none of them really solved my problem. I studied them carefully and hope you can learn what you want here.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!