1

I want to have some swipe functionality on an image gallery on the mobile version of a site I'm building, so as I've been using jQuery, I thought I'd use the jQuery Mobile swipeleft and swiperightevents. This all works fine, but I notice that when the page loads I get a the word loading appear on the page.

Is this the loading widget? And if so how can I set it so that it doesn't show?

2 Answers 2

3

You can turn it of with a:

$( 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 = "";
});

It is also good to know that this block must be initialized before jQuery Mobile is initialized inside a HEAD, like this:

<!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>

Find more about this functionality here.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @Gajotres for your answer and pointer about initializing the block before initializing jQuery Mobile in the head tag.
0

try this:

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

OR

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

however you do it, the important piece is

$.mobile.hidePageLoadingMsg();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.