Rapahel画板不工作 [英] Rapahel Sketchpad not working

查看:108
本文介绍了Rapahel画板不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的代码。我使用了raphael sketchpad插件。但我无法画画,我只是空白的画板。为什么会这样?

 < html> 
< head>
< script type =text / javascriptsrc =jquery.min.js>< / script>
< script type =text / javascriptsrc =raphael-min.js>< / script>
< script type =text / javascriptsrc =json2.js>< / script>
< script type =text / javascriptsrc =raphael.sketchpad.js>< / script>

< script type =text / javascript>

$(document).ready(function(){
var sketchpad = Raphael.sketchpad(editor,{
height:260,
width:260 ,
editing:true

));

//当画板改变时,更新输入栏
sketchpad.change(function() {
$(#data)。val(sketchpad.json());
});

});

< / script>
< / head>
< body>
< input type =hiddenid =data/>
< div id =editorstyle =border:1px solid #aaa;>< / div>

< h1>测试及LT; / H1>



< / body>
< / html>

当我尝试添加笔画时,我会看到一条对角线。

$ b $当我使用最新版本的jquery和raphael时,它现在适用于我。我做了下面的修改

 < script type =text / javascriptsrc =http://ajax.googleapis.com /ajax/libs/jquery/1.4.2/jquery.min.js\"></script> 
< script type =text / javascriptsrc =raphael-2.0.1.js>< / script>


Below is my code.I have used raphael sketchpad plugin. But I'm unable to draw,I just get blank sketchpad. Why is it so?

<html>
     <head>
          <script type="text/javascript" src="jquery.min.js"></script>
          <script type="text/javascript" src="raphael-min.js"></script>
          <script type="text/javascript" src="json2.js"></script>
          <script type="text/javascript" src="raphael.sketchpad.js"></script>

   <script type="text/javascript">

    $(document).ready(function() {
    var sketchpad = Raphael.sketchpad("editor", {
            height: 260,
            width: 260,
            editing: true

        });

        // When the sketchpad changes, update the input field.
        sketchpad.change(function() {
            $("#data").val(sketchpad.json());
        });

});

</script>
     </head>
    <body>
<input type="hidden" id="data" />
<div id="editor" style="border: 1px solid #aaa; "></div>

<h1> Testing</h1>



    </body>
</html>

When I try to add a stroke,I get a diagonal line.

解决方案

When I used latest version jquery and raphael,it's working for me now. I did below modification

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="raphael-2.0.1.js"></script>

这篇关于Rapahel画板不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆