how to 'fix' the header footer position using jquery mobile with data-position=“fixed”

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 10:07:01

问题


i am using jquery mobile and for header/footer i am using data-position="fixed".

However, when we scroll the page... the header footer goes away ands reappear when scrolling stops.. Is there a way we could just make it fixed on the screen an show all the time you are scrolling ?

I can only think of a way is to apply position fixed and not use jquerymobile for these elements..


回答1:


I tried my best to get this to work. If you want you can delete the function that changes the header and footer class from .ui-fixed-overlay to .ui-fixed-inline and remove the webkit animation from .fade.in and .fade.out, but I've had no lock preventing the windows from disappearing. However, I believe JQM only recalculates the position of the header and footer elements after you scroll.

I put the following css in page div to remove the webkit animation.

.ui-fixed-inline { opacity: 1!important; display:block!important; -webkit-animation-name:none!important; } .fade.in, .fade.out { opacity: 1!important; -webkit-animation-name:none!important; display:block!important; }

I know this is not what you want but it does speed up the reappearance of the header and footer elements (it looks a bit choppy.) Unless you want to rewrite the JQM javascript that controls the header and footer positioning, I don't think there is any easy way to do this as the JQM fixed position code is built to re-position after the user scrolls. I'll keep looking and edit this answer if I find a way.




回答2:


A simpler version of Chase's code works fine for me:

/* sass - remove toolbar fade */
.nofade{
 &.in, &.out {
    -webkit-animation-name:none;
 }
}


Note that tap-to-hide toolbars uses this same fade property, so the following is required:

$.mobile.fixedToolbars.setTouchToggleEnabled false  # coffeescript


来源:https://stackoverflow.com/questions/6364227/how-to-fix-the-header-footer-position-using-jquery-mobile-with-data-position

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!