Hide address bar in mobile Safari when scrolling (touchOverflow)

后端 未结 1 862
天命终不由人
天命终不由人 2021-01-07 01:50

I want to kind of continue some other Question:

How does jquery mobile hide mobile safari's addressbar?

this hides the adressbar after page is loaded.

1条回答
  •  没有蜡笔的小新
    2021-01-07 02:25

    SOLUTION

    i thought about the scroll position and ended up with this:

                        var touchHeight = $('.mobile-touch-overflow').height(),
                            screenHeight = utils.getScreenHeight() - (utils.notStandalone()?44:0);
                        // touchOverflow: hide adressbar when scrolling
                        if(touchHeight > screenHeight && utils.supportTouchOverflow())
                        {
                            $('.mobile-touch-overflow').bind('touchmove',function(){
                                if($('.page-content').offset().top < 0)
                                {
                                    utils.windowScroll(1);
                                }
                                return true;
                            });
                        }
    

    and here the test file:

    
    
        
            title
            
            
            
            
            
            
    
            
    
            
    
            
        
    
        
    
            

    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    ###
    Footer

    0 讨论(0)
提交回复
热议问题