/* 编程素材网 www.1sucai.cn */
(function($)
{
//code here
})(jQuery);
/* 编程素材网 www.1sucai.cn */
var defaultSettings = {
mode : 'Pencil',
lineWidthMin : '0',
lineWidthMax : '10',
lineWidth : '2'
};
settings = $.extend({}, defaultSettings, settings || {});
$.fn.wPaint = function(settings)
{
return this.each(function()
{
var elem = $(this);
//run some code here 编程素材网 www.1sucai.cn
}
}
var defaultSettings = {
mode : 'Pencil',
lineWidthMin : '0',
lineWidthMax : '10',
lineWidth : '2'
};
$.fn.wPaint = function(settings)
{
settings = $.extend({}, defaultSettings, settings || {});
return this.each(function()
{
var elem = $(this);
//run some code here 编程素材网 www.1sucai.cn
}
}
/* 编程素材网 www.1sucai.cn */
function Canvas(settings)
{
this.settings = settings;
this.draw = false;
this.canvas = null;
this.ctx = null;
return this;
}
/* 编程素材网 www.1sucai.cn */
Canvas.prototype =
{
generate: function()
{
//generate code
}
}
Canvas.prototype =
{
generate: function()
{
//some code
var $this = this;
var buton = //...some code
button.click(function(){
//using this will not be found since it has it's own this
//use $this instead.
$this.someFunc($this);
});
},
someFunc: function($this)
{
//won't know what "this" is.
//use $this instead passed from the click event
}
} /* 编程素材网 www.1sucai.cn */
function Canvas(settings)
{
this.settings = settings;
return this;
}
generate() appendColors() colorSelect() colorHoverOn() colorHoverOff() appendToElement() showPalette() hidePalette()
varlineWidth = $("#container").wPaint("lineWidth");
$("#container").wPaint("lineWidth","5");
return this.each(function()
{
var elem = $(this);
var canvas = new Canvas(settings);
//run some code here
elem.data("_wPaint_canvas", canvas);
}
//下面的代码明确了我们究竟要做什么:
$.fn.wPaint = function(option, settings)
{
if(typeof option === 'object')
{
settings = option;
}
else if(typeof option === 'string')
{
if(
this.data('_wPaint_canvas') &&
defaultSettings[option] !== undefined
){
var canvas = this.data('_wPaint_canvas');
if(settings)
{
canvas.settings[option] = settings;
return true;
}
else
{
return canvas.settings[option];
}
}
else
return false;
}
return this.each(function()
{
//run some code here
}
} /* 编程素材网 www.1sucai.cn */
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有