| 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>Carousel Demo (dojo.store)</title> |
| 8 | |
| 9 | <script type="text/javascript" src="../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base','Carousel','PageIndicator']"></script> |
| 10 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true, mblAlwaysHideAddressBar: true"></script> |
| 11 | |
| 12 | <script type="text/javascript"> |
| 13 | require([ |
| 14 | "dojo/_base/connect", |
| 15 | "dojo/store/JsonRest", |
| 16 | "dojo/ready", |
| 17 | "dijit/registry", |
| 18 | "dojox/mobile/parser", |
| 19 | "dojox/mobile", |
| 20 | "dojox/mobile/compat", |
| 21 | "dojox/mobile/ScrollableView", |
| 22 | "dojox/mobile/StoreCarousel" |
| 23 | ], function(connect, JsonRest, ready, registry){ |
| 24 | store1 = new JsonRest({target: "data/carousel-categ.json"}); |
| 25 | ready(function(){ |
| 26 | connect.subscribe("/dojox/mobile/carouselSelect", function(w, img, item, idx){ |
| 27 | if(w.id == "carousel1"){ |
| 28 | var store2 = new JsonRest({target: "data/carousel-"+item.value+".json"}); |
| 29 | var w2 = registry.byId("carousel2"); |
| 30 | w2.set("title", item.value); |
| 31 | w2.setStore(store2); |
| 32 | registry.byId("rect1").domNode.style.display = "none"; |
| 33 | }else if(w.id == "carousel2"){ |
| 34 | var rect1 = registry.byId("rect1"); |
| 35 | var u = "unknown"; |
| 36 | var desc = "<div style='float:right;font:14px arial;width:49%'>Model: "+(item.model?item.model:u)+"<br>"+ |
| 37 | "Design: "+(item.design?item.design:u)+"<br>"+ |
| 38 | "Produced: "+(item.produced?item.produced:u)+"<br>"+ |
| 39 | "Size: "+(item.size?item.size:u)+"<br>"+ |
| 40 | "Price: "+(item.price?item.price:u)+"<br></div>"; |
| 41 | rect1.containerNode.innerHTML = desc+"<img src='"+item.src+"' width='50%' align='top'>"; |
| 42 | rect1.domNode.style.display = ""; |
| 43 | } |
| 44 | }); |
| 45 | }); |
| 46 | }); |
| 47 | </script> |
| 48 | </head> |
| 49 | <body style="visibility:hidden;background-color:#6D6D6D"> |
| 50 | <div id="foo" data-dojo-type="dojox.mobile.ScrollableView"> |
| 51 | <div id="carousel1" data-dojo-type="dojox.mobile.StoreCarousel" |
| 52 | data-dojo-props='height:"150px", navButton:true, store:store1, itemWidth:156, title:"Category"'></div> |
| 53 | <div id="carousel2" data-dojo-type="dojox.mobile.StoreCarousel" |
| 54 | data-dojo-props='height:"110px", navButton:true, itemWidth:100'></div> |
| 55 | <div id="rect1" data-dojo-type="dojox.mobile.RoundRect" style="display:none"></div> |
| 56 | </div> |
| 57 | </body> |
| 58 | </html> |