jQuery Mobile - $ .mobile.showPageLoading () при переключении - PullRequest
4 голосов
/ 17 января 2012

Возможно ли это, если у вас есть $ .mobile.ajaxEnabled = false;

Я пробовал

$('.test').toggle(function() {
      $.mobile.showPageLoading()
});

Ответы [ 2 ]

3 голосов
/ 17 января 2012

Будет ли это работать:

JS

$('#toggle1').click(function() {
    // Happens to fast, will not show loading message
    $.mobile.showPageLoadingMsg();
    $('.booleanToggle').toggle();
    $.mobile.hidePageLoadingMsg();
});

$('#toggle2').click(function() { 
    $.mobile.showPageLoadingMsg();  
    $('.transitionToggle').toggle("slow", function() {
        // Animation complete, hide message
        $.mobile.hidePageLoadingMsg();
    });
});

HTML

<div data-role="page" id="home">
    <div data-role="content">
        <a href="#" data-role="button" id="toggle1">Toggle 1 (Boolean)</a>        
        <br />
        <div id="div1" class="booleanToggle">
Bacon ipsum dolor sit amet capicola chuck flank, pork loin ribeye prosciutto pork tail chicken ball tip frankfurter biltong pig. Rump boudin t-bone capicola shankle venison biltong. Meatloaf sirloin pork chop beef ribs short loin, tenderloin pork salami pastrami drumstick shankle ham hock frankfurter. Ham prosciutto sausage, spare ribs ham hock beef ribs frankfurter leberkase flank strip steak tongue. Boudin bacon pancetta, drumstick ham hock pork tenderloin biltong chuck pork belly ball tip short ribs tri-tip jowl. Ham pastrami tongue pork. Hamburger strip steak boudin turkey frankfurter flank ribeye, beef ribs turducken meatball fatback short ribs pork andouille tri-tip.
        </div>
        <div id="div2" style="display:none;" class="booleanToggle">
Strip steak ground round shankle, swine tri-tip cow ham hock. Pancetta meatloaf venison pork loin, pork swine shoulder jowl sirloin drumstick andouille turkey brisket. Meatloaf pork loin spare ribs biltong jowl, bresaola ham pastrami fatback tongue t-bone. Kielbasa shank pork belly flank tenderloin frankfurter. Corned beef ground round sirloin turducken frankfurter pastrami, filet mignon salami ball tip tongue tri-tip beef ribs. Rump jowl short loin, turkey corned beef sausage ham hock chuck. Tail shoulder prosciutto andouille pork, bresaola short loin biltong.
        </div>
        <br /><br />
        <a href="#" data-role="button" id="toggle2">Toggle 2 (Duration)</a>
        <div id="div3" class="transitionToggle">
Bacon ipsum dolor sit amet capicola chuck flank, pork loin ribeye prosciutto pork tail chicken ball tip frankfurter biltong pig. Rump boudin t-bone capicola shankle venison biltong. Meatloaf sirloin pork chop beef ribs short loin, tenderloin pork salami pastrami drumstick shankle ham hock frankfurter. Ham prosciutto sausage, spare ribs ham hock beef ribs frankfurter leberkase flank strip steak tongue. Boudin bacon pancetta, drumstick ham hock pork tenderloin biltong chuck pork belly ball tip short ribs tri-tip jowl. Ham pastrami tongue pork. Hamburger strip steak boudin turkey frankfurter flank ribeye, beef ribs turducken meatball fatback short ribs pork andouille tri-tip.
        </div>
        <div id="div4" style="display:none;" class="transitionToggle">
Strip steak ground round shankle, swine tri-tip cow ham hock. Pancetta meatloaf venison pork loin, pork swine shoulder jowl sirloin drumstick andouille turkey brisket. Meatloaf pork loin spare ribs biltong jowl, bresaola ham pastrami fatback tongue t-bone. Kielbasa shank pork belly flank tenderloin frankfurter. Corned beef ground round sirloin turducken frankfurter pastrami, filet mignon salami ball tip tongue tri-tip beef ribs. Rump jowl short loin, turkey corned beef sausage ham hock chuck. Tail shoulder prosciutto andouille pork, bresaola short loin biltong.
        </div>
    </div>
</div>
0 голосов
/ 17 января 2012

Я думаю, вам, скорее всего, придется сделать это в pageinit. Главное, чтобы загрузчик загружался до перехода страницы

$('#yourid').live('pageinit',function(event){
  $.mobile.showPageLoading()
});
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...