Rapahel Sketchpad not working

半城伤御伤魂 提交于 2019-12-11 19:53:10

问题


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.


回答1:


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>


来源:https://stackoverflow.com/questions/17595404/rapahel-sketchpad-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!