html5简单绘图程序,jQuery+HTML5的绘图应用程序

query.deviantartmuro是一个jQuery插件,允许您在网站上进行图像绘制和编辑,并保存图片。

ca7b6acfc902d0efe4b31303703340d7.png

使用很简单

$('#damuro-goes-here').damuro({

// Say what image we want the user to embed.

background: 'images/crane_squared_by_mudimba_and_draweverywhere.png',

// Locate a sandbox to quarantine third-party javascript in.

sandbox: 'html/deviantart_muro_sandbox.html',

// Set a custom loading screen message.

loadingText: 'This is a customized loading message...',

// Make the "click to play" splash screen have a funky colour.

splashCss: {

color: '#33a'

},

// We don't want to have deviantART muro load automatically.

autoload: false

})

// Bind a single-use onclick handler to open muro when they click on the splash screen.

.one('click', function () { $(this).damuro().open(); })

// Chain down to the damuro object rather than $('#damuro-goes-here').

.damuro()

// The .damuro() object is a promise, so lets bind a done() and fail() handler.

.done(function (data) {

if (data.image && !/\'/.test(data.image)) {

// Here's where you'd save the image, we'll just set the header background as an example.

$('.inner').css('backgroundImage', "url('" + data.image + "')");

// And scroll to the top so you see it.

$('html, body').animate({

scrollTop: $('.inner').offset().top

}, 200);

}

// And remove deviantART muro from the page.

$(this).hide().damuro().remove();

})

.fail(function (data) {

$(this).hide().damuro().remove();

if (data.error) {

// Something failed in saving the image.

$('body').append('

All aboard the fail whale: ' + data.error + '.

');

} else {

// The user pressed "done" without making any changes.

$('body').append("

Be that way then, don't edit anything.

");

}

});

相关链接

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值