Tizen app上的上下文菜单

时间:2016-07-21 19:19:59

标签: contextmenu tizen tizen-web-app

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

我试过了,

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

显示

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

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:5)

您需要添加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>

这是垂直样式(基本)

的演示

enter image description here

  

请参阅Tizen在线样本'TAUUIComponents'了解TAU示例