以下代碼的目的是禁用鼠標右鍵和視頻容器元素(客戶請求)上的上下文菜單的右鍵單擊。但是,它似乎也擊倒了我們需要啓動視頻所需的左鍵單擊。禁用視頻元素的上下文菜單
我該如何編碼,以便只有右鍵點擊被禁用。
$(document).ready(function() {
$('.video-container').bind('contextmenu', function() { return false; });
});
HTML是:
<div class="video-container" data-videoname="" data-flash="http://yyy.net/video1.flv">
<video id="flashContent" width="944" height="531" controls="controls">
<source src="http://yyy.net/video1.mp4" type="video/mp4">
<source src="http://yyy.net/video1.ogv" type="video/ogg">
</video>
<div class="poster">
<div class="content">
<img src="/media/es-es/121111/different.png" width="944" height="531">
<img class="button" alt="Play this video" src="../../images/buttons/icon_video_play.png">
</div>
</div>
</div>
你能提供你的元素女巫類'。視頻 - container'的代碼?謝謝 – pes502
向我們顯示您的HTML代碼。 – urbz
您的客戶知道,這實際上並不會阻止任何人右鍵單擊其真正想要的人,對吧?相關:http://stackoverflow.com/questions/9756837/prevent-html5-video-from-being-downloaded-right-click-saved –