简体   繁体   English

如何修复jQuery Mobile的固定页脚?

[英]How to fix jQuery Mobile's fixed footer?

Using jQueryMobile, I've included data-role="footer" data-position="fixed" in the markup, but two bugs persist: 使用jQueryMobile,我在标记中包含了data-role="footer" data-position="fixed" ,但仍存在两个错误:

  • Footer toggles on a null click event. 页脚在空单击事件上切换。
  • Footer isn't fixed, and hides some of the page content. 页脚未修复,并隐藏了部分页面内容。

I'm testing with iPhone 3g. 我正在测试iPhone 3g。 Any ideas? 有任何想法吗?

Thanks in advance. 提前致谢。

UPDATE : It seems that the click event modifies the current page's footer, and changes ui-fixed-overlay to ui-fixed-inline , which of course is styled display:none to prevent the other pages' footers from appearing. 更新 :似乎click事件修改了当前页面的页脚,并将ui-fixed-overlay更改为ui-fixed-inline ,当然其样式为display:none以防止其他页面的页脚出现。

How can I prevent this modification? 我该如何防止这种修改?

If using 1.1 or later , add data-tap-toggle="false" to your header and footer, as documented here . 如果使用1.1或更高版本 ,请将data-tap-toggle="false"到页眉和页脚,如此处所述

If you're using a version of jQuery Mobile prior to 1.1 , place the following before loading jQuery Mobile: 如果您使用1.1之前的jQuery Mobile版本,请在加载jQuery Mobile之前放置以下内容:

$(document).bind("mobileinit", function(){
  $.mobile.touchOverflowEnabled = true;
}); // remove

This is fixed in jQueryMobile 1.1 rc1. 这在jQueryMobile 1.1 rc1中得到修复。 See here . 看到这里

Use data-tap-toggle="false" on your footer. 在页脚上使用data-tap-toggle =“false”

使用jquery.mobile-1.0a4将数据位置=“固定”添加到页脚部分,在Iphone,Android和Chrome中按需运行

The current "answer" may be a bit misguided. 目前的“答案”可能有点误导。 Using touchOverflow may help you in the short-term, but that will soon be going away. 使用touchOverflow可能会在短期内帮助您,但很快就会消失。 If anyone were to read the jQuery mobile blog , they would notice this blurb posted on Jan. 10: 如果有人要阅读jQuery移动博客 ,他们会注意到1月10日发布的这个模糊:

Heads up: touchOverflow to be deprecated in 1.1 – When we first introduced the touchOverflow feature, we saw it as a good way to leverage the native overflow support in iOS to bring true fixed toolbars and smoother transitions, even if it was for a fairly narrow set of devices at the time. 抬头:touchOverflow将在1.1中弃用 - 当我们首次推出touchOverflow功能时,我们认为它是利用iOS中的原生溢出支持来带来真正的固定工具栏和更平滑过渡的好方法,即使它是相当狭窄的当时的一套设备。 Now with the significant changes to fixed headers and transition planned for 1.1, these will improve the experience in an almost identical way as touchOverflow, except it will work on a lot more platforms and with less complexity so we've decided to retire this feature. 现在随着对1.1的固定标题和转换的重大更改,这些将以与touchOverflow几乎相同的方式改善体验,除了它将在更多平台上工作并且复杂性更低,因此我们决定退出此功能。 It will be deprecated at 1.1 and removed at 1.2. 它将在1.1处弃用,在1.2处删除。 We do have future plans for addressing overflow regions with internal scrolling so a lot of the work we've done on touchOverflow will be re-purposed. 我们确实有未来计划通过内部滚动来解决溢出区域,因此我们在touchOverflow上所做的大量工作将被重新定位。

Apologies for posting this as an answer, but I am unable to comment at this point. 抱歉将此作为答案发布,但此时我无法发表评论。

我做了非常简单的事情。用CSS创建解决方案只为内容设置了适当的“最小高度”。将停止页脚跳转页面的内容。

We had this problem and used a combination of iScroll (v3) and a nice jquery mobile wrapper for iScroll. 我们遇到了这个问题,并使用iScroll(v3)和iScroll的一个漂亮的jquery移动包装器的组合。 It works perfectly. 它完美地运作。 See all the details here: 查看此处的所有详细信息:

http://yappo.github.com/projects/jquery.mobile.iscroll/livedemo.html http://yappo.github.com/projects/jquery.mobile.iscroll/livedemo.html

i use jquery mobile 1.3.1, and all that you said earlier doesn't work on my app. 我使用jquery mobile 1.3.1,你之前说的所有内容都不适用于我的应用程序。 but i've a solution for this bug. 但我有一个解决这个bug的方法。 check my other post JQueryMobile - fixed footer not fixed after input focus 检查我的其他帖子JQueryMobile - 固定页脚在输入焦点后没有固定

$('div:jqmData(role="page")').on('pageinit',function(){
    $(document)
        .on('focus','input, select, textarea', function(){
            $('[data-role="footer"][data-position="fixed"]').hide();
        })
        .on('blur','input, select, textarea',function(){
            $('[data-role="footer"][data-position="fixed"]').show();
        });
});

I've had similar issue with the footer not being fixed on scroll either. 我也有类似的问题,页脚没有固定在滚动上。 My suggestion? 我的建议? Sencha and not jQueryMobile, its loaded with bugs and not ready for production. Sencha而不是jQueryMobile,它装载了bug并且还没有准备好生产。

The footer also highlights the selected page from URL /#page thing url affects the footer menu in my case. 页脚还会从URL /#页面突出显示所选页面。在我的情况下,url会影响页脚菜单。

Re: Footer isn't fixed, and hides some of the page content. Re:页脚未固定,并隐藏了部分页面内容。

I struggled with this problem, too. 我也在努力解决这个问题。 Turned out that I had to move the ending content div tag to be BEFORE the start of the Footer. 原来我必须将结束内容div标签移动到页脚开始之前。 If the footer is inside the content div tag - and you turn on >>> data-position="fixed" <<<, then my footer isn't fixed. 如果页脚在内容div标签内 - 并且您打开>>> data-position =“fixed”<<<,那么我的页脚不会被修复。

I don't know about your other problem, "Footer toggles on a null click event" as I don't know how to re-create that in my app. 我不知道你的另一个问题,“页脚切换无效点击事件”,因为我不知道如何在我的应用程序中重新创建它。

USING... 使用...

  • JQuery Mobile 1.3.2 JQuery Mobile 1.3.2
  • Cordova 科尔多瓦
  • The footer has a navbar and an advertising banner inside it. 页脚内部有一个导航栏和一个广告横幅。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM