jQuery-mobile and ASP.NET combination issue

后端 未结 2 1434
庸人自扰
庸人自扰 2021-01-14 13:10

I am developing a mobile solution with a combination of jQuery.mobile and asp.net webforms.

For postbacks of my asp.net controls to work properly I have to disable

2条回答
  •  粉色の甜心
    2021-01-14 13:32

    Document ready can not be successfully used with jQuery Mobile. It will usually trigger before page DOM is populated.

    Instead of this line:

    $(document).ready(function () {        
        $('#myPopup').popup('open'); 
    });
    

    Use this line:

    $(document).on('pagebeforeshow', '#page-id', function(){       
        $('#myPopup').popup('open'); 
    });
    

    Where #page-id is an id of page that contains that popup.

    jQuery Mobile has a problem with document ready so its developers have created page evenets to remedy this problem, read more about it in this ARTICLE or find it HERE.

    EDIT :

    I think your problem is also in $.mobile.ajaxEnabled = false; handling.

    That code sample MUST be triggered from mobileinit event like this:

    $(document).bind("mobileinit", function () {
        $.mobile.ajaxEnabled = false;
    });
    

    One more thing, mobileinit event MUST be triggered before jQuery Mobile is initialized, like this:

          
    
      
    

提交回复
热议问题