jquery简单插件制作(fn.extend)完整实例
本文实例讲述了jquery简单插件制作方法。分享给大家供大家参考,具体如下:
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=UTF-8">
<scripttype="text/javascript"src="jquery.js"></script>
<title>jquery简单的插件制作</title>
<scripttype="text/javascript">
(function($){
$.fn.greenify=function(options){
varsettings=$.extend({
color:"#556b2f",
backgroundColor:'#000',
padding:'20px'
},options);
returnthis.css({
color:settings.color,
backgroundColor:settings.backgroundColor,
padding:settings.padding
});
};
}(jQuery));
$(document).ready(function(){
$("div").greenify({
color:"#000",
backgroundColor:'#ccc',
padding:'50px'
})
});
</script>
</head>
<body>
<divid="accordion">
jquery简单的插件制作
</div>
</body>
</html>
更多关于jQuery相关内容感兴趣的读者可查看本站专题:《jquery中Ajax用法总结》、《jQuery表格(table)操作技巧汇总》、《jQuery拖拽特效与技巧总结》、《jQuery扩展技巧总结》、《jQuery常见经典特效汇总》、《jQuery动画与特效用法总结》、《jquery选择器用法总结》及《jQuery常用插件及用法总结》
希望本文所述对大家jQuery程序设计有所帮助。