我發現這個jQuery解決方案可以自動覆蓋真實圖像上的透明gif。在Fancybox框架內自動覆蓋真實圖像的透明gif
http://www.dwuser.com/education/content/stop-the-thieves-strategies-to-protect-your-images/
( 「欺瞞下載」)
它工作正常,在我的WordPress網站(訴3.5.1)用的fancybox插件(訴1.3.4)。
但現在與圖像有關的所有我的鏈接都不見了...
是否有任何解決方案,以保持與圖像有關的活動鏈接?
我也試圖覆蓋GIF屬性只對的fancybox框架內的圖像,但沒有成功......
>>編輯發佈關聯CODE < <
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
var pixelSource = 'http://upload.wikimedia.org/wikipedia/commons/c/ce/Transparent.gif';
var useOnAllImages = true;
// Preload the pixel
var preload = new Image();
preload.src = pixelSource;
$('img').live('mouseenter touchstart', function(e) {
// Only execute if this is not an overlay or skipped
var img = $(this);
if (img.hasClass('protectionOverlay')) return;
if (!useOnAllImages && !img.hasClass('protectMe')) return;
// Get the real image's position, add an overlay
var pos = img.offset();
var overlay = $('<img class="protectionOverlay" src="' + pixelSource + '" width="' + img.width() + '" height="' + img.height() + '" />').css({position: 'absolute', zIndex: 9999999, left: pos.left, top: pos.top}).appendTo('body').bind('mouseleave', function() {
setTimeout(function(){ overlay.remove(); }, 0, $(this));
});
if ('ontouchstart' in window) $(document).one('touchend', function(){ setTimeout(function(){ overlay.remove(); }, 0, overlay); });
});
});
</script>
感謝和對不起我的英文不好。 d。
你可以嘗試,以防止潛在的小偷,但遺憾的是沒有用JavaScript真正的保護(我可以下載任何圖像你的網站無論你怎麼努力欺騙我。)最好的辦法是找到一個服務器端解決方案,如果你不想手動添加水印,它可以即時爲你的圖像添加水印。潛在的盜賊仍然可以下載你的水印圖像。 – JFK 2013-04-08 15:38:08
檢查http://fancyapps.com/fancybox/#useful第4代的代碼示例添加水印和禁用右鍵單擊,如果這有助於您的安心;) – JFK 2013-04-08 15:40:15