0

私はiOSでいくつかのWebAppを作成しており、これを使用して作業用のデータを収集しています。しかし、私はそれにいくつかの問題を見つけました。

書きたいプログラムはとてもシンプルで、触ると絵が消えてしまいます。だから私はこの非常に単純なコードを思いついた。

<!DOCTYPE HTML>
<html lang="en-US" manifest="manifest.mf">
<head>
    <meta charset="UTF-8">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />  
    <meta name="viewport" content="width=device-width; initial-scale=1.0; user-scalable=0;">
    <link rel="apple-touch-icon-precomposed" href="icon.png"/> 
    <style type="text/css">

    *{
        -webkit-touch-callout: none;
    }

</style>
<script src="http://code.jquery.com/jquery.min.js"></script>

<script>
function show_coords(event)
{
var x=event.offsetX;
var y=event.offsetY;
//alert("X coords: " + x + ", Y coords: " + y);
$("#result p").text("coX= "+x+" coY= " +y);
}

 $(document).ready(function() {
        $('img').each(function() {
            $(this).click(function() {
                $(this).stop().animate({ opacity: 1.0 }, 1);
            },
           function() {
               $(this).stop().animate({ opacity: 0.0 }, 0);
           });
        });
    });
</script>
    <title>DataCollect</title>
</head>
<body>
<img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><br>
<img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><br>
<img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><br>
<img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><br>
<img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><img src="flower.gif"width='50' height='50' onmousedown="show_coords(event)" /><br>

<div id='result'>
    <p></p>
</div>
</body>
</html>

このコードは、PCのブラウザで非常にうまく機能します。それは私が望むように日焼けして反応します。しかし、iPhoneのSafariで実行すると。少し遅れているようです。画像が突然消えることはありません。少し遅れているようです。

あなたたちはここであなたのiOSのSafariを試すことができます http://jjwestwind.tk/napp/

だから、私は何をすべきですか?この種のアプリケーションをWebAppで作成する他の方法はありますか?または、ネイティブアプリに戻るしかありませんか?(これは私が他のユーザーにそれを提供するのに多くの問題を引き起こします)

私を助けてください!どうもありがとう :)

4

1 に答える 1

0

この回答が推奨するように、クリック遅延をなくすと役立つ場合があります。クリック遅延を削除する

または、このFastClickコードのjavascriptコードを使用してください。

于 2013-02-09T22:56:23.183 に答える