简体   繁体   English

右键单击图像时显示此内容

[英]display this when right click on an image

I tried to create a website to display each product with an image, but I want to disable it to users to download the image's product when the user right-click on it, he/she can't to download it or Open the image on new tab to download, I read many questions on StackOverflow about it but nothing tells me how to do it.我试图创建一个网站来显示带有图像的每个产品,但我想禁用它让用户在用户右键单击它时下载图像的产品,他/她不能下载它或打开图像要下载的新标签,我在 StackOverflow 上阅读了很多关于它的问题,但没有告诉我该怎么做。 I want to display this box which on the below image appears.我想显示下图中出现的这个框 在此处输入图像描述

please help me.请帮我。

Just cover your image like this像这样覆盖你的图像

<!DOCTYPE html>
<html lang="en-us">
<head>
  <title>some title</title>
  <style>
    * {
      box-sizing: border-box;
    }
    .img-container {
      width: 300px;
      height: 200px;
      position: relative;
    }
    .img-container img, .img-container .img-cover {
      width: 100%;
      height: 100%;
    }
    .img-container .img-cover {
      position: absolute;
      top: 0;
      left: 0;
    }
  </style>
</head>
<body>

  <div class="img-container">
    <img src="your_image.png">
    <div class="img-cover"></div>
  </div>

</body>
</html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM