我正在使用html,js,tau和jquery开发一个tizen Web应用程序。
当用户单击特定位置时,我需要上下文菜单。
有可能这样做吗?

我试过了,

$("#myContextMenu").popup('open');

表明
 TypeError: $(...).popupwindow is not a function

任何帮助将不胜感激。

最佳答案

您需要添加TAU库。 TAU具有不同类型的上下文菜单。
这样尝试

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" href="./lib/tau/mobile/theme/default/tau.css">
    <meta name="description" content="Tizen Mobile Application"/>
    <title>Hello Tizen</title>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <script src="js/main.js"></script>
    <script type="text/javascript" src="./lib/tau/mobile/js/tau.js"></script>
</head>

<body>
   <div class="ui-page" id="list-styles-page">
    <div class="ui-header" data-position="fixed">
        <h1>Home</h1>
    </div>
    <div class="ui-content">

         <ul class="ui-listview">
            <li class="ui-group-index">Horizontal Style</li>
            <li class="ui-li-anchor"><a href="#ctxpopup_horizontal_basic" data-inline="true" data-rel="popup">Horizontal Basic</a></li>
            <li class="ui-li-anchor"><a href="#ctxpopup_horizontal_scroll" data-inline="true" data-rel="popup">Horizontal Scroll</a></li>
            <li class="ui-li-anchor"><a href="#ctxpopup_horizontal_2line" data-inline="true" data-rel="popup">Horizontal 2line</a></li>
            <li class="ui-group-index">Vertical Style</li>
            <li class="ui-li-anchor"><a href="#ctxpopup_vertical_basic" data-inline="true" data-rel="popup">Vertical Basic</a></li>
        </ul>

        <div id="ctxpopup_horizontal_basic" class="horizontal-ctxpopup ui-popup" data-overlay="false">
            <ul class="ui-listview">
                <li class="ui-li-anchor"><a href="#" data-rel="back">Copy</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Cut</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Paste</a></li>
            </ul>
        </div>

        <div id="ctxpopup_horizontal_scroll" class="horizontal-ctxpopup ui-popup" data-overlay="false">
            <ul class="ui-listview">
                <li class="ui-li-anchor"><a href="#" data-rel="back">Copy</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Cut</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Paste</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Clipboard</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Close</a></li>
            </ul>
        </div>
        <div id="ctxpopup_horizontal_2line" class="horizontal-ctxpopup ui-popup" data-overlay="false">
            <ul class="ui-listview">
                <li class="ui-li-anchor"><a href="#" data-rel="back">Select All</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Cut</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Copy</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Paste</a></li>
            </ul>
            <ul class="ui-listview">
                <li class="ui-li-anchor"><a href="#" data-rel="back">Clipboard</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Dictionary</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Translate</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Share via</a></li>
            </ul>
        </div>

        <div id="ctxpopup_vertical_basic" class="ui-popup" data-overlay="false">
            <ul class="ui-listview">
                <li class="ui-li-anchor"><a href="#" data-rel="back">Copy</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Cut</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Paste</a></li>
                <li class="ui-li-anchor"><a href="#" data-rel="back">Clipboard</a></li>
            </ul>
        </div>
    </div>
</div>
</html>

这是垂直样式(基本)的演示

contextmenu - Tizen应用程序上的上下文菜单-LMLPHP

请参阅Tizen在线示例“TAUUIComponents”以获取TAU示例

关于contextmenu - Tizen应用程序上的上下文菜单,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38512678/

10-12 15:29