嗨我希望我的網站有多個上下文菜單,每個菜單都可以在div內單擊鼠標右鍵。 (不同div的不同菜單)。問題是我迄今發現的菜單沒有允許我使用這個網站5力下載鏈接:我想讓我的網站有多個上下文菜單
<a href="Title Blue.png" download="Title Blue.png">Download Title Picture</a>
我想這是該鏈接指向我的上下文菜單中的項目之一。
我發現了這段腳本,但它不起作用,因爲它裏面有語法錯誤。
<script>
$(document).bind(「contextmenu」,(e)) {
e.preventDefault(); // To prevent the default context menu.
$(「#cntnr」).css(「left」, e.pageX); // For updating the menu position.
$(「#cntnr」).css(「top」, e.pageY); //
$(「#cntnr」).fadeIn(500, startFocusOut()); // For bringing the context menu in picture.
};
function startFocusOut() {
$(document).on(「click」, function() {
$(「#cntnr」).hide(500); // To hide the context menu
$(document).off(「click」);
});
}
$(「#items > li」).click(function() {
$(「#op」).text(「You have selected 「 + $(this).text()); // Performing the selected function.
});
</script>"
另一半就是這將是我的HTML 5的下載鏈接兼容標準的HTML列表:
<span id=」op」>Demo Time</span> // For showing output.
<div id=’cntnr’> // Context menu container.
<ul id=’items’> // List of items in context menu.
<li>Item1</li> // Items to show in context menu.
<li>Item2</li>
<li>Item3</li>
<li>Item4</li>
<li>Item5</li>
</ul>
</div>
任何人都可以找出錯誤或者給我開了使用內我的HTML 5鏈接不同的上下文菜單
感謝
任何控制檯錯誤?用螢火蟲檢查它,看看錯誤。並且也改變這個引號「像這樣」 – mehmetakifalp