|
UICoverFlow模块(界面布局基本组件)demo示例
[复制链接]
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
- <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
- <title>title</title>
- <link rel="stylesheet" type="text/css" href="../css/api.css" />
- <style>
- body {}
- html,
- body {
- height: 100%
- }
- body {
- background-color: #fff;
- margin: 0;
- }
- a.button {
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-box-pack: center;
- -webkit-box-align: center;
- height: 32px;
- margin: 8px;
- background-color: rgba(240, 240, 240, 1.0);
- border-color: rgba(220, 220, 220, 1.0);
- border-width: none;
- }
- a.active {
- background-color: rgba(240, 240, 240, 0.7);
- }
- </style>
- </head>
- <body>
-
- </body>
- <script type="text/javascript" src="../script/api.js"></script>
- <script type="text/javascript">
- var UICoverFlow;
- var fs;
- apiready = function() {
- UICoverFlow = api.require('UICoverFlow');
- fs = api.require('fs');
- fnDownload();
- fs.exist({
- path: 'fs://test.png'
- }, function(ret, err) {
- if (ret.exist) {
- if (ret) {
- } else {
- fs.remove({
- path: 'fs://test.png'
- }, function(ret, err) {
- if (ret.status) {
- fnDownload();
- } else {
- }
- });
- }
- } else {
- }
- });
- };
- function fnDownload() {
- api.download({
- url:'http://**.**1.z0.glb**.**/apicloud/22453f9993f0f35045c7bf7df850eb00.jpg',
- savePath: 'fs://test.png',
- report: true,
- cache: true,
- allowResume: true
- }, function(ret, err) {
- if (ret.state == 1) {
- setTimeout('fnOpen()', 1000)
- } else {
- }
- });
- }
- function fnOpen() {
- UICoverFlow.open({
- rect: {
- x: 0,
- y: 0,
- w: api.winWidth,
- h: api.frameHeight
- },
- styles: {
- bg: '#fff',
- image: {
- activeW: 300,
- activeH: 400,
- corner: 2,
- placeholder: 'fs://test.png'
- }
- },
- images: [{
- url: 'fs://test.png'
- }, {
- url: 'fs://test.png'
- }, {
- url: 'fs://test.png'
- }, {
- url: 'fs://test.png'
- }],
- index: 2,
- interval: 2000,
- fixedOn: api.frameName,
- fixed: false
- }, function(ret, err) {
- if (ret) {
- } else {
- }
- });
- }
- </script>
- </html>
复制代码 利用fs模块和UICoverFlow模块做了个小demo,
|
|