Disable rubber-band scrolling for webview in lion

前端 未结 3 635
暗喜
暗喜 2020-12-15 12:48

I have a Cocoa webview, with a web application in it. The web application has a fixed toolbar itself, and with the elastic scrolling, and the toolbar coming below the top, i

相关标签:
3条回答
  • 2020-12-15 12:51

    Maybe this article would help you.

    In short: disable overflow on HTML and BODY, add a wrapper with overflow:auto around all the page contents

    0 讨论(0)
  • 2020-12-15 13:00

    I know this comment likely won't be accepted, since there's already an answer.

    However, there's an actual method you can call on your NSView (docs here):

    [[[webView mainFrame] frameView] setAllowsScrolling:NO]; 
    
    0 讨论(0)
  • 2020-12-15 13:09

    If you're interested in doing it from the WebView and Cocoa perspective, you can also implement the finish load delegate, grab the scroll view, and disable elasticity:

    - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
        NSScrollView *mainScrollView = sender.mainFrame.frameView.documentView.enclosingScrollView;
        [mainScrollView setVerticalScrollElasticity:NSScrollElasticityNone]; 
        [mainScrollView setHorizontalScrollElasticity:NSScrollElasticityNone];
    }
    
    0 讨论(0)
提交回复
热议问题