问题
I am developing an app for Windows 8.1. I tried below code it's not working.
<WebView Source="http://wikipedia.org"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollMode="Disabled"/>
Is there any JavaScript solution to disable touch, mouse & key board scrolling?
回答1:
I have used below given JS for my requirement. Though I am waiting for a better (XAML) solution.
function RemoveScrolling()
{
var styleElement = document.createElement('style');
var styleText = 'body, html { overflow: hidden; }'
var headElements = document.getElementsByTagName('head');
styleElement.type = 'text/css';
if (headElements.length == 1)
{
headElements[0].appendChild(styleElement);
}
else if (document.head)
{
document.head.appendChild(styleElement);
}
if (styleElement.styleSheet)
{
styleElement.styleSheet.cssText = styleText;
}
}
来源:https://stackoverflow.com/questions/20103527/how-to-disable-webview-scrolling-in-windows-8-1