(080)jquery_插件_contextMenu

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>plug_contextMenu.html</title>
    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <link rel="stylesheet" type="text/css" href="../css/jquery_contextMenu/jquery.contextmenu.css"></link>
    <style type="text/css">
        #divtest
        {
            width: 282px;
        }
        #divtest .title
        {
            padding: 8px;
            background-color: Blue;
            color: #fff;
            height: 23px;
            line-height: 23px;
            font-size: 15px;
            font-weight: bold;
        }
        #divtest .content
        {
            padding: 8px 0px;
            background-color: #fff;
            font-size: 13px;
        }
        #divtest .content .tip
        {
            text-align: center;
            border: solid 1px #ccc;
            background-color: #eee;
            margin: 20px 0px;
            padding: 8px;
            display: none;
        }
        .fl
        {
            float: left;
        }
        .fr
        {
            float: right;
        }
    </style>
    <script type="text/javascript" src="../js/jquery/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="../js/jquery_contextMenu/jquery.contextmenu.js"></script>
    <script type="text/javascript">
        $(function(){
            $("#btnSubmit").contextMenu("sysMenu",{
                bindings:{
                    "li1":function(item){
                        $(".tip").show().html("您点击了保存项");
                    },
                    "li2":function(item){
                        $(".tip").show().html("您点击了退出项");
                    }
                }
            });
        });
    </script>
  </head>
  
  <body>
        <div id="divtest">
            <div class="title"><span class="fl">点击右键</span></div>
            <div class="content">
                <input id="btnSubmit" type="button" value="提交" />
                <div class="tip"></div>
            </div>
            <div id="sysMenu" class="contextMenu">
                <ul>
                    <li id="li1"><img src="http://img.mukewang.com/52e4b34b0001bb6d00160016.jpg" alt="" />保存</li>
                    <li id="li2"><img src="http://img.mukewang.com/52e4b3680001424900160016.jpg" alt="" />退出</li>
                </ul>
            </div>
        </div>
  </body>
</html>

$(selector).contextMenu(menuId,{options});

Selector参数为绑定插件的元素,meunId为快捷菜单元素,options为配置对象。

posted @ 2015-01-08 15:58  雪中飞雁  阅读(87)  评论(0)    收藏  举报