-1

I am using the following mobile-me script that can be seen here:

http://lokeshdhakar.com/projects/mobileme-particles/

I have noticed that it is blocking my ability to select text on the site. For example if you use your mouse to select “Created by: lokesh dhakar” at the footer of the page, it cannot be done.

Here is the github repository:

https://github.com/lokesh/mobileme-particles

I need help finding what is blocking the text from being selected in this project. Any assistance is greatly appreciated.

codacopia
  • 2,369
  • 9
  • 39
  • 58

1 Answers1

2

I'll start with words of wisdom :

Disabling text selection is bad. Don't use this.

From http://api.jqueryui.com/disableselection/

.disableSelection()

Otherwise you can change the background of your text selection to match the other background

::selection {
  background: #ffb7b7; 
}

or from : How to disable text selection using jQuery?

(function($){
  $.fn.disableSelection = function() {
    return this
             .attr('unselectable', 'on')
             .css('user-select', 'none')
             .on('selectstart', false);
  };
})(jQuery);

EDIT : (From me and Presto) add Modernizr.addTest("userselect",function(){ return Modernizr.testAllProps("user-select"); }); to the js file and I can now select the text :)

Community
  • 1
  • 1
Glukose
  • 478
  • 4
  • 12
  • Thank you for the wise words. I am trying to take it out of this script. I will search now to see if this is listed there. – codacopia Sep 10 '14 at 13:39
  • I didn't too... don't know where it's hidden. If you do a CTRL+A you can select the text though – Glukose Sep 10 '14 at 13:44
  • well thanks for checking. I will keep searching and hopefully find it. – codacopia Sep 10 '14 at 13:47
  • try look inside the modernizr plugin I just found a mention of user-select here [link](https://github.com/Modernizr/Modernizr/issues/250) – Glukose Sep 10 '14 at 13:48
  • That does it, thanks! I just had to add `Modernizr.addTest("userselect",function(){ return Modernizr.testAllProps("user-select"); });` to the `js` file and I can now select the text :) If you want to note this in your answer I will award it right away. – codacopia Sep 10 '14 at 13:58
  • Unfortunately this also breaks the particles from displaying... ohh well. I'll keep working with it. – codacopia Sep 10 '14 at 14:00