开发者

Cocoa WebView, WebKit - Prevent I-Beam cursor from showing over text?

开发者 https://www.devze.com 2023-01-11 09:40 出处:网络
Cocoa app, SnowLeopard I have a WebView in to which I\'m loading HTML (essentially for applic开发者_JS百科ation UI purposes).

Cocoa app, SnowLeopard

I have a WebView in to which I'm loading HTML (essentially for applic开发者_JS百科ation 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号