javascript 启用 Chrome 插件后如何从我网站上的图像中隐藏 Pin It 按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22231387/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to hide Pin It button from images on my website when Chrome plugin is enabled
提问by Saurabh Sharma
Hi I have chrome Pinterest plugin installed and when it is enabled, I see "Pin It" button (on hover) on all images on my website, How can i stop "Pin It" button to appear on my website, even when a chrome extension is enabled
嗨,我安装了 chrome Pinterest 插件,当它启用时,我在我网站上的所有图像上看到“Pin It”按钮(悬停时),我怎样才能停止“Pin It”按钮出现在我的网站上,即使是 chrome扩展已启用
After googling, I found the following on a blog:
谷歌搜索后,我在博客上发现了以下内容:
You can easily disable this as an individual who has installed the extension, but if you don't want it to conflict with any other social software you may have on your site, all you need to do is add this to ever IMG tag:
<img src="myimage.jpg" data-pin-no-hover />
作为安装了扩展程序的个人,您可以轻松地禁用它,但如果您不希望它与您网站上可能拥有的任何其他社交软件发生冲突,您需要做的就是将其添加到 IMG 标签中:
<img src="myimage.jpg" data-pin-no-hover />
But that's for single image, is there any other way to override the plugin to disable "pin it" button from chrome extension? using JS/jQuery?
但那是针对单个图像的,有没有其他方法可以覆盖插件以禁用 chrome 扩展中的“固定”按钮?使用 JS/jQuery?
Chrome extension js: http://assets.pinterest.com/ext/cr.js
Chrome 扩展 js:http: //assets.pinterest.com/ext/cr.js
EDIT
编辑
<img src="myimage.jpg" data-pin-no-hover />
doesn't seem to work anymore
<img src="myimage.jpg" data-pin-no-hover />
似乎不再工作
回答by Saurabh Sharma
Okay I just read the Pinterest documentation, To disable the pinterest on a page or website, just add a meta tag:
好的,我刚刚阅读了 Pinterest 文档,要在页面或网站上禁用 pinterest,只需添加一个元标记:
<meta name="pinterest" content="nopin" />
And pinterest button will stop appearing on the website anymore.
并且 pinterest 按钮将不再出现在网站上。
回答by Charlie
Edit, sorry should say that my response addresses your edit specifically:
编辑,抱歉应该说我的回复专门针对您的编辑:
You need to specify the true switch for the attribute if you just want to disable the hover pin it button on one image.
如果您只想禁用一个图像上的悬停固定按钮,则需要为该属性指定 true 开关。
<img src="myimage.jpg" data-pin-no-hover="true" />
... will do it
... 会做的
回答by Blog Ambitions
If you want to disable the hover pin it button on Google Chrome, use this mark up in your HEAD:
如果您想在 Google Chrome 上禁用悬停固定按钮,请在您的 HEAD 中使用此标记:
<meta name="pinterest" content="nohover"></meta>
You can read more about it on Pinterest's blog: http://businessblog.pinterest.com/post/77184942682/a-smarter-pin-it-button
您可以在 Pinterest 的博客上阅读更多相关信息:http: //businessblog.pinterest.com/post/77184942682/a-smarter-pin-it-button
using the no pin
code disables pinning on that image
使用no pin
代码禁用固定在该图像上
Hope that helps,
希望有所帮助,
Kristie
克里斯蒂
回答by j morley
I spent hours to figure this out, only to find that it is as easy as adding this to your image tag
我花了好几个小时才弄明白这个问题,结果发现把它加到你的图片标签上就这么简单
nopin="nopin"
nopin="nopin"
回答by giovannipds
You have two methods:
你有两种方法:
1) Disabling it to a single image(Charlie's answer), as you'd have done, but you have forgotten the value "true"
, it is necessary:
1)将其禁用为单个图像(查理的回答),正如您所做的那样,但您忘记了价值"true"
,这是必要的:
<img src="myimage.jpg" data-pin-no-hover="true" />
2) Disabling it to the whole document(Saurabh Sharma's answer), at document's <head>
:
2)在整个文档中禁用它(Saurabh Sharma 的回答),在文档中<head>
:
<meta name="pinterest" content="nopin" />
You just have to chose which case will suit you better.
您只需要选择哪种情况更适合您。
回答by DeaconRodda
Charlie's answer from Mar 12 '14 at 20:34 is now outdated. The most reliable method is to add nopin="nopin"
as an image attribute:
Charlie 于 2014 年 3 月 12 日 20:34 的回答现已过时。最可靠的方法是添加nopin="nopin"
为图像属性:
<img class="block__el--hide" src="path/imgname_1500x900.png" nopin="nopin">
<img class="block__el--hide" src="path/imgname_1500x900.png" nopin="nopin">
~DR
~博士
回答by The Vanilla Thrilla
If you want to disable it for all images, you could try the following jQuery:
如果要对所有图像禁用它,可以尝试以下 jQuery:
$('img').attr('data-pin-no-hover', '');