1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | function createArticlesList() { artListSVC = new ScrollContainer({ scrollview: {direction: Utility.Direction.Y} }); var lines = []; artListSVC.sequenceFrom(lines); for (var i in articles) { var surf = new Surface({ content: '<div class="a-title">' + articles.title + '</div><div class="a-desc">' + articles.desc + '</div>', size: [undefined, 100], properties: { itemType: 'article', listIndex: i, textAlign: 'left', color: 'black' } }); surf.artIdx = i; surf.pipe(eh); lines.push(surf); } } function createWebSurface() { wb = new Surface( ); } |
1 2 3 4 5 | function createWebSurface() { wb = new Surface( ); } |
1 2 3 4 5 6 7 8 9 | function createVideoSurface() { vs = new VideoSurface( { size: [undefined,undefined], autoplay: true } ); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | function addHeader() { nb = new NavigationBar({ size: [undefined, 75], content: 'dW Famo.us', moreContent: '', backContent: '', properties: { lineHeight: '75px' } }); layout.header.add(nb); eh.subscribe(nb); eh.on('back', function() { rc.setOptions({ inTransition: false, outTransition: true }); if (backTarget !== undefined) rc.show(backTarget); setNavbarBack(false, undefined); }); } |
1 2 3 4 5 6 7 8 9 | function addContent() { rc = new EdgeSwapper({ overlap: false, outTransition: false, size:[undefined, undefined] }); layout.content.add(rc); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | function addFooter() { var tb = new TabBar({ }); layout.footer.add(tb); tb.defineSection(0,{content: 'Articles', onClasses: ['tabbuton'], offClasses: ['tabbutoff']}); tb.defineSection(1,{content: 'Videos', onClasses: ['tabbuton'], offClasses:['tabbutoff']}); tb.select(0); eh.subscribe(tb); eh.on('select', function(but) { rc.setOptions({ inTransition: false, outTransition: false }); switch (but.id) { case 0: rc.show(artListSVC); break; case 1: rc.show(vidListSVC); break; } setNavbarBack(false, undefined); }); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | function init() { rc.show(artListSVC); eh.on('click', function(obj) { rc.setOptions( { inTransition: true, outTransition: false }); var surfaceProps = obj.origin.getProperties(); if (surfaceProps.itemType === 'article') { wb.setContent('<iframe width="100%" height="100%" src="' + articles[surfaceProps.listIndex].url + '"></iframe>'); rc.show(wb); setNavbarBack(true, artListSVC); } else { // video vs.setContent(videos[surfaceProps.listIndex].url); rc.show(vs); setNavbarBack(true, vidListSVC); } }); } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |