好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

小强的HTML5移动开发之路(39)——jqMobi插件json格式ActionSheet

在上一篇中我们学会了ActionSheet的使用,细心的朋友可能会发现其中创建列表的格式是HTML的,代码如下:

function showCustomHtmlSheet() {
     $("#afui").actionsheet('<a  >Back</a><a  onclick="alert(\'hi\');" >Show Alert 3</a><a  onclick="alert(\'goodbye\');">Show Alert 4</a>');
} 
<a class="button" onclick="showCustomJsonSheet()">Show Custom Json Sheet</a> 
                        function showCustomJsonSheet() {
                            $("#afui").actionsheet(
                            [{
                                text: 'back',
                                cssClasses: 'red',
                                handler: function () {
                                    $.ui.goBack();
                                }
                            }, {
                                text: 'show alert 5',
                                cssClasses: 'blue',
                                handler: function () {
                                    alert("hi");
                                }
                            }, {
                                text: 'show alert 6',
                                cssClasses: '',
                                handler: function () {
                                    alert("goodbye");
                                }
                            }]);
                        } 
<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<title>jqMobi</title>
<link href="css/af.ui.css" rel="stylesheet" type="text/css"/>
<link href="css/icons.css" rel="stylesheet" type="text/css"/>
<script src="appframework.js" type="text/javascript"></script>
<script src="ui/appframework.ui.js" type="text/javascript"></script>
</head> 
<body> 
	<p id="afui">
    	<p id="content">
        	<p id="home" title="首页" class="panel" selected="true"
            	data-footer="custom_footer">
           		<a class="button" onclick="showCustomJsonSheet()">Show Custom Json Sheet</a>
            </p>
            <p id="about" title="关于我们" class="panel"
            	data-footer="custom_footer">
                
           	</p>
            <header id="custom_header">
            	<h1>首页</h1>
            </header>
            <footer id="custom_footer">
            	<a href='#home' class='icon home'>首页</a>
                <a href='#about' class='icon info'>关于我们</a>
            </footer>
            <nav>
            	<p class='title'>Home</p>
                <ul>
                	<li><a class="icon home mini" href="#main">Home</a></li>
                </ul>
            </nav>
        </p>
    </p>
    <script>
		function showCustomJsonSheet() {
			$("#afui").actionsheet(
			[{
				text: 'back',
				cssClasses: 'red',
				handler: function () {
					$.ui.goBack();
				}
			}, {
				text: 'show alert 5',
				cssClasses: 'blue',
				handler: function () {
					alert("hi");
				}
			}, {
				text: 'show alert 6',
				cssClasses: '',
				handler: function () {
					alert("goodbye");
				}
			},{
				text: '大碗干拌',
				cssClasses: 'red',
				handler: function () {
					alert("哈哈");
				}
			}]);
		}             
	</script>
</body>
</html> 
#afui #af_actionsheet a{
    border-radius:0;
    -webkit-border-radius:0;
    color:black;
    /*background:white;*/
    border:none;
    text-shadow:none;
} 
<style>
	#afui #af_actionsheet a{
		color:blue;
	}
</style> 

效果如下:


以上就是小强的HTML5移动开发之路(39)——jqMobi插件json格式ActionSheet的内容,更多相关内容请关注PHP中文网(HdhCmsTestgxlcms测试数据)!

查看更多关于小强的HTML5移动开发之路(39)——jqMobi插件json格式ActionSheet的详细内容...

  阅读:48次