简体   繁体   中英

ReferenceError for 3rd party library used in jQuery plugin, on android

I'm working on an app that uses a jQuery UI plugin, which in turn uses the Raphael library. Things work great on iOS and normal browsers, but on android I am getting the error:

ReferenceError: can't find variable Raphael

raised in this line of the init method of the jQuery UI plugin I wrote (jquery.ui.sketch.js):

var p = Raphael(el.attr("id")); 

This is the head of my index.html that I'm using to mock-up my app:

<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>

<script type="text/javascript" src="/js/raphael.js"></script>
<script type="text/javascript" src="/js/raphael.json.js"></script>
<script type="text/javascript" src="jquery.ui.sketch.js"></script>

And the body looks like:

<body id="home">
 ... a bunch of divs
<script type="text/javascript">

$(function(){

            // ...jquery stuff that works fine

            // initialize sketch widget, FAILS HERE ON ANDROID:
            $('#paper').sketch({
                saved: function(e,ui){
                    savedDrawing = ui;
                    alert("saved JSON to a global variable 'savedDrawing'");
                },
                // these could be bound to an element if we want:
                startdrawing: function(){
                    console.log("figure started");
                },
                donedrawing: function(){
                    console.log("finished drawing");
                }
            });

</script>

I'm kind of stumped.

Seems the issue is simply that Raphael doesn't support Android (or rather has no way of doing SVG). Duh. Apparently v3.0 browser has SVG support.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM