0

I want to show an image gallary and to do that, I just have to inport a js script and I have to link to a specific js-link. That's not the problem, it works fine, but when I click the image I linked to the js, it gets selected, like I tried to copy it as I would do with text. How do I prevent that?


EDIT: Just saw that it just selects the image in Dreamweaver, so it works fine in my browser, but if someone does have the problem, feel free to read the answers below.

Sergio
  • 28,539
  • 11
  • 85
  • 132
Axel Köhler
  • 911
  • 1
  • 8
  • 34

2 Answers2

1

You can do it with CSS:

-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: moz-none;
-ms-user-select: none;
user-select: none;

From here: How to disable text selection highlighting using CSS?

Community
  • 1
  • 1
bobek
  • 8,003
  • 8
  • 39
  • 75
0

This maybe what you're looking for I think... http://www.htmlforums.com/showpost.php?s=036e4d900055ebc4446548d66536e4f1&p=785058&postcount=2

<style>
img{
    -moz-user-select: none;
    -webkit-user-select: none;
    user-select: none;
}
</style>

you can also use the "unselectable" attribute however not all browsers support it.

<img src="img.jpg" unselectable="on">

Banning
  • 2,279
  • 2
  • 16
  • 20