Cocoa WebView,WebKit - 防止I-Beam光标在文本上显示? [英] Cocoa WebView, WebKit - Prevent I-Beam cursor from showing over text?

查看:259
本文介绍了Cocoa WebView,WebKit - 防止I-Beam光标在文本上显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cocoa应用程式,SnowLeopard



我有一个WebView,我要加载HTML(基本上用于应用程序UI目的)。



在html中,我添加了:

 < body onselectstart =return falseondragstart =return false> 

这可以防止选择文本,这是我想要的工作。



但是,只要光标移动到任何文本上,包括禁用的按钮文本,光标就会变为I-Beam,产生讨厌的不想要的效果。



有什么方法可以在HTML或WebKit中更改此行为?



感谢您的帮助。

解决方案

尝试将 -webkit-user-select:none;



实际上,如果您只想显示不同的光标,请使用:

  #myelement {
cursor:default;
}

这将显示一个常规指针而不是选择I-Beam。 p>

Cocoa app, SnowLeopard

I have a WebView in to which I'm loading HTML (essentially for application UI purposes).

In the html, I've added:

<body onselectstart="return false" ondragstart="return false">

This prevents text from being selected, which is what I want for this job.

However, whenever the cursor is moved over any text, including disabled "button" texts, the cursor changes to the I-Beam, producing a nasty, unwanted effect.

Is there any way to change this behaviour, either in HTML or in WebKit?

Thanks for any help.

解决方案

Try adding the -webkit-user-select: none; declaration to each of the selectors you don't want to be user-selectable.

Actually, if you just want to show a different cursor, use this:

#myelement {
    cursor: default;
}

This will show a regular pointer instead of the selection I-Beam.

这篇关于Cocoa WebView,WebKit - 防止I-Beam光标在文本上显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆