用jQuery设置文本选择颜色。演示不工作 [英] Set the text selection color with jQuery. Demo not working

查看:144
本文介绍了用jQuery设置文本选择颜色。演示不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://jsfiddle.net/uKdPM/

我在css中设置了 :: selection 颜色,因此当您在屏幕上突出显示文本时,文本的颜色为粉色。我正试图在页面加载时通过jQuery覆盖该颜色。似乎应该是超级简单。

I've set the ::selection color in css, so when you highlight the text on the screen, the color of the text is pink. I'm trying to now override that color through jQuery when the page loads. Seems like it should be super simple. But it's not working for me.

推荐答案

我相信如果你想实现这种效果,你需要应用颜色基于CSS类进行更改。我分了你的jsfiddle,并后面的结果

I believe if you want to achieve this kind of effect, you need to apply the color change based on a CSS class. I forked your jsfiddle, and heres the result

虽然我认为你的问题是有趣的,我有一个困难的时间计算,这可以投入实际使用。您要随时更改主题吗?

Although i think your question is interesting, im having a difficult time figuring where this can be put to practical use. Do you want to change the theme on the fly?

这篇关于用jQuery设置文本选择颜色。演示不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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