Is there user-select for Opera 10.62 and IE9?

前端 未结 5 882
耶瑟儿~
耶瑟儿~ 2020-12-28 20:48

I have been trying to apply user-select for both Opera 10.62 and IE9 without success. I can\'t/won\'t bind events with JavaScript that preventDefault()

相关标签:
5条回答
  • 2020-12-28 21:04

    You can use combination of -webkit-user-select: none;, -moz-user-select: none; and specific property unselectable="on", as I described here:

    How to make text unselectable on HTML page

    0 讨论(0)
  • 2020-12-28 21:10

    Did you try using ::selection {color:currentColor;background:transparent}?
    For Firefox you can use ::-moz-selection.

    https://developer.mozilla.org/En/CSS/::selection
    http://msdn.microsoft.com/en-us/library/ff974109(v=VS.85).aspx
    http://reference.sitepoint.com/css/pseudoelement-selection


    // update //
    There's also the unselectable property.

    0 讨论(0)
  • 2020-12-28 21:11

    Using jquery:

    $('.element').mousedown( function(e) {
        e.preventDefault();
    });
    

    But you may have to add it both to the element and it's container.

    0 讨论(0)
  • 2020-12-28 21:14

    -ms-user-select: none;

    seems to work fine now (IE 10/11)

    0 讨论(0)
  • 2020-12-28 21:21

    user-select isn't a standard CSS3 property, which is why there is no user-select or -o-user-select or -ms-user-select. It used to be in the old user interface spec, but that was superseded by the Basic UI spec. It will likely never be implemented by either browser, unless it is added back to the spec.

    User selection is a behaviour rather than a style, so it is best to use JavaScript. As Knu mentions above, you can use unselectable instead.

    0 讨论(0)
提交回复
热议问题