jQuery的移动和ASP.NET合并事项 [英] jQuery-mobile and ASP.NET combination issue

查看:111
本文介绍了jQuery的移动和ASP.NET合并事项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发展与jQuery.mobile和组合的移动解决方案
asp.net web表单。

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

有关我的asp.net控件回发到正常工作我有禁用阿贾克斯
在页面的顶部,这样的:

For postbacks of my asp.net controls to work properly I have to disable ajax at the top of the page, like this:

   <script>
      $.mobile.ajaxEnabled = false;
   </script>

但是,当Ajax是这样的禁用,其他功能似乎并没有工作。
我不能叫对话框/ jQuery的,从弹出的文件准备好

But when ajax is disabled like this, other functions doesn't seem to work. I can't call dialogs/popups from jQuery document ready

例如:

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

这将正义事业弹出在不到一秒钟的展示,
那么自败。此外,当我注册一个clientscript
从codebehind触发弹出时,服务器端的按钮
单击,在弹出的只是闪烁,然后自败。
但是,当我在页面顶部禁用AJAX,弹出
电话工作正常。

This will just cause the popup to show in less than a second, then it dissapears. Also when I register a clientscript from codebehind to trigger the popup when a serverside button is clicked, the popup just flashes, then dissapears. But when I disable ajax at the top of the page, the popup calls works fine.

任何想法如何解决这些问题?

Any ideas how to get around these issues?

推荐答案

文件准备好不能成功使用的 jQuery Mobile的 。它通常将页面之前触发 DOM 填充。

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

而不是此行的:

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

使用这一行:

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

其中, #页-ID 是网页的ID包含弹出。

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

jQuery Mobile的具有文档准备一个问题,所以它的开发者已经创建了页面evenets来解决这个问题,在这个文章 或找到它的 HERE

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.

编辑:

我觉得你的问题也是 $ mobile.ajaxEnabled = FALSE; 处理

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

这code样品的<​​strong>必须从触发 mobileinit 事件是这样的:

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

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

还有一件事, mobileinit 活动的必须之前被触发的 的jQuery移动 被初始化,如:

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

<script src="http://www.dragan-gaic.info/js/jquery-1.8.2.min.js"></script>      
<script>
        $(document).bind("mobileinit", function () {
            $.mobile.ajaxEnabled = false;
        });    
</script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>  

这篇关于jQuery的移动和ASP.NET合并事项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆