| 1 | <!doctype html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> |
| 5 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/> |
| 6 | <meta name="apple-mobile-web-app-capable" content="yes"/> |
| 7 | <title>Button</title> |
| 8 | <script type="text/javascript" src="../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base','Button']"></script> |
| 9 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true"></script> |
| 10 | |
| 11 | <script type="text/javascript"> |
| 12 | require([ |
| 13 | "dojo/_base/connect", |
| 14 | "dojo/ready", |
| 15 | "dojo/_base/array", |
| 16 | "dojo/dom", |
| 17 | "dijit/registry", |
| 18 | "dojox/mobile/parser", |
| 19 | "dojox/mobile", |
| 20 | "dojox/mobile/compat", |
| 21 | "dojox/mobile/Button", |
| 22 | "dojox/mobile/ScrollableView" |
| 23 | ], function(connect, ready, array, dom, registry){ |
| 24 | ready(function(){ |
| 25 | array.forEach(["btn1", "btn2", "btn3", "btn4", "btn5"], function(btnId){ |
| 26 | var btnWidget = registry.byId(btnId); |
| 27 | connect.connect(btnWidget.domNode, "click", onBtnClicked); |
| 28 | }); |
| 29 | }); |
| 30 | var clickCount = 0; |
| 31 | function onBtnClicked(e){ |
| 32 | clickCount = ++clickCount; |
| 33 | var span = dom.byId("msgArea"); |
| 34 | span.innerHTML = "button '" + this.id + "' received a " + ((e._dojo_click)?"dojo":"native") + " click (" + clickCount + ").<br />" + span.innerHTML ; |
| 35 | } |
| 36 | }); |
| 37 | </script> |
| 38 | |
| 39 | <style> |
| 40 | html,body { |
| 41 | overflow: hidden; |
| 42 | } |
| 43 | hr { |
| 44 | border: none; |
| 45 | margin: 0; |
| 46 | } |
| 47 | button { |
| 48 | width: 120px; |
| 49 | margin: 15px 10px 0; |
| 50 | } |
| 51 | button.customButton { |
| 52 | border-color: #cc3333; |
| 53 | background-image: url(images/red-button-bg.png); |
| 54 | color: #ffffff; |
| 55 | height: 27px; |
| 56 | } |
| 57 | button.customButtonSelected { |
| 58 | background-image: url(images/red-button-sel-bg.png); |
| 59 | } |
| 60 | </style> |
| 61 | </head> |
| 62 | <body style="visibility:hidden;"> |
| 63 | <div data-dojo-type="dojox.mobile.ScrollableView"> |
| 64 | <h1 data-dojo-type="dojox.mobile.Heading">Button</h1> |
| 65 | <div data-dojo-type="dojox.mobile.RoundRect" data-dojo-props='shadow:true'> |
| 66 | <br> |
| 67 | <br>Scroll down and click buttons. On Touch devices, a touch should fire a "dojo" click. On desktop a |
| 68 | mouse click should fire a "native" event. |
| 69 | <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> |
| 70 | <br>onClick response:<br> |
| 71 | <div id="msgArea" style="margin:15px"></div> |
| 72 | <br> |
| 73 | <button data-dojo-type="dojox/mobile/Button" id="btn1">Default</button> |
| 74 | <hr> |
| 75 | <button data-dojo-type="dojox/mobile/Button" id="btn2" class="mblBlueButton">Blue</button> |
| 76 | class="mblBlueButton" |
| 77 | <hr> |
| 78 | <button data-dojo-type="dojox/mobile/Button" id="btn3" class="mblRedButton">Red</button> |
| 79 | class="mblRedButton" |
| 80 | <hr> |
| 81 | <button data-dojo-type="dojox/mobile/Button" id="btn4" disabled>Disabled</button> |
| 82 | disabled |
| 83 | <hr> |
| 84 | <button data-dojo-type="dojox/mobile/Button" id="btn5" class="customButton">Custom</button> |
| 85 | class="customButton" |
| 86 | </div> |
| 87 | </div> |
| 88 | </body> |
| 89 | </html> |