如何在 Windows 8.1 中禁用 WebView 滚动 [英] How to disable WebView scrolling in Windows 8.1
本文介绍了如何在 Windows 8.1 中禁用 WebView 滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为 Windows 8.1 开发应用程序.我试过下面的代码它不起作用.
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"/>
是否有任何 JavaScript 解决方案可以禁用触摸、鼠标和鼠标?键盘滚动?
Is there any JavaScript solution to disable touch, mouse & key board scrolling?
推荐答案
我使用了下面给出的 JS 来满足我的要求.虽然我在等待更好的 (XAML) 解决方案.
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;
}
}
这篇关于如何在 Windows 8.1 中禁用 WebView 滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文