1

私が構築しているサイトのモバイル版の画像ギャラリーでスワイプ機能を使用したいので、jQuery を使用してきたので、jQuery Mobileswipeleftswiperightイベントを使用すると考えました。これはすべて正常に機能しますが、ページが読み込まれると、loading という単語がページに表示されることに気付きました。

これは読み込み中のウィジェットですか? もしそうなら、それを表示しないように設定するにはどうすればよいですか?

4

2 に答える 2

3

あなたはそれをオフにすることができます:

$( document ).bind( 'mobileinit', function(){
    $.mobile.loader.prototype.options.text = "loading";
    $.mobile.loader.prototype.options.textVisible = false;
    $.mobile.loader.prototype.options.theme = "a";
    $.mobile.loader.prototype.options.html = "";
});

次のように、HEAD 内で jQuery Mobile を初期化する前に、このブロックを初期化する必要があることも知っておくとよいでしょう。

<!DOCTYPE html>
<html>
<head>
    <title>jQM Complex Demo</title>
    <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
    <script src="http://www.dragan-gaic.info/js/jquery-1.8.2.min.js"></script>          
    <script>
        $( document ).bind( 'mobileinit', function(){
            $.mobile.loader.prototype.options.text = "loading";
            $.mobile.loader.prototype.options.textVisible = false;
            $.mobile.loader.prototype.options.theme = "a";
            $.mobile.loader.prototype.options.html = "";
        });     
    </script>
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>    
</head>

この機能の詳細については、こちらをご覧ください。

于 2013-03-04T17:21:28.570 に答える
0

これを試して:

$(document).on("swiperight", "body", function() {
    $.mobile.changePage("#page1");
    $.mobile.hidePageLoadingMsg();
});

また

$("body").on( "swipeleft swiperight", function( event ) {
    $.mobile.changePage("#page1");
    $.mobile.hidePageLoadingMsg();
});

どんなにやっても大事な部分は

$.mobile.hidePageLoadingMsg();
于 2013-03-04T19:05:25.893 に答える