码迷,mamicode.com
首页 > 其他好文 > 详细

测试代码

时间:2015-12-18 20:20:21      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

<script src="Jscript/jquery-1.11.1.min.js"></script>
<script src="Jscript/jquery.mobile-1.4.5.min.js"></script>
<script src="Jscript/jquery.touchSwipe.js"></script>
<title></title>
<style type="text/css">
* {
padding: 0px;
margin: 0px;

}

body {
width: 100%;
height: 100%;
}

.ui-loader {
display: none;
}

.img-container {
width: 100%;
position: absolute;
height: 100%;
overflow: hidden;
background-color: black;
pointer-events: auto;
}


.layout {
position: absolute;
width: 100%;
height: 100%;
top: 0px;
background-color: white;
overflow: hidden;
pointer-events: none
}

.layout img {
width: 100%;
height: 100%;
position: absolute;
}

.div-bg {
position: absolute;
opacity: 0;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.div-bg1{
position: absolute;
opacity: 0;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events:none;
}

@-webkit-keyframes keyup {
from {
top: 0px;
transform: scale(1);
}

to {
transform: scale(0.5);
top: -100%;
}
}

@-webkit-keyframes keyup1 {
from {
top: 100%;
}

to {
top: 0;
}
}

@-webkit-keyframes keydown {
from {
top: 0;
}

to {
top: 100%;
}
}

@-webkit-keyframes keydown1 {
from {
top: -100%;
}

to {
top: 0;
}
}
</style>
</head>
<body>
<div class="img-container">
<div class="div-bg"></div>
<div class="div-bg1"></div>
<div class="layout">
<img src="images/wall1.jpg" />
</div>
</div>
</body>
</html>
<script type="text/javascript">
var workArry;

workArry = {
"code": 200, "data": {
"thumbnail": "http://img01.cloud7.com.cn/work_pic.jpg",
"title": "好麻烦啊希望可以没心没肺的活着的初页",
"mode": "push",
"pageSwitch": { "animateId": "push" },
"backgroud": { "color": "#FFFFFF" },
"music": {}, "pages": [
//图
{ "layout": { "label": "SingleImage", "image": [{ "url": "http://img01.cloud7.com.cn/371a9a98071ed29cbd09f3f8d4102e38.jpg!compress", "imageinfo": { "x": 0, "y": 0, "width": 320, "height": 504, "type": "image" } }], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144492982 } },
{ "layout": { "label": "MutipleImage01", "image": [{ "images": ["http://img01.cloud7.com.cn/51e310717d92ecea943d094b99e8b129.jpg!compress", "http://img01.cloud7.com.cn/8db72c786ab85cef9c22e9f5a43e3b68.jpg!compress", "http://img01.cloud7.com.cn/ae9ca394ee259bd095c099669bb1e8ff.jpg!compress", "http://img01.cloud7.com.cn/371a9a98071ed29cbd09f3f8d4102e38.jpg!compress"], "arrow": "", "imageinfo": { "x": 35, "y": 61, "width": 251, "height": 381 } }], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144492983 } },
{ "layout": { "label": "MutipleImage02", "image": [{ "url": "http://img01.cloud7.com.cn/70b14bbce1a3763cef4097f3516ce81e.jpg!compress", "imageinfo": { "x": 15, "y": 14, "width": 293, "height": 162, "type": "image" } }, { "url": "http://img01.cloud7.com.cn/c6f1827dd51fdd7ca50afe2f4463d352.jpg!compress", "imageinfo": { "x": 15, "y": 175, "width": 292, "height": 160, "type": "image" } }, { "url": "http://img01.cloud7.com.cn/401073aac9f7159673d008797db2282c.jpg!compress", "imageinfo": { "x": 15, "y": 330, "width": 291, "height": 160, "type": "image" } }], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144492984 } },
{ "layout": { "label": "MutipleImage03", "image": [{ "url": "http://img01.cloud7.com.cn/515f0f1ce572d4ff15eb32c4547ddd7b.jpg!compress", "imageinfo": { "x": 15, "y": 15, "width": 290, "height": 232, "type": "image" } }, { "url": "http://img01.cloud7.com.cn/c5e8b8e7cb9ebb3d26b90bc4bd711840.jpg!compress", "imageinfo": { "x": 15, "y": 250, "width": 143, "height": 240, "type": "image" } }, { "url": "http://img01.cloud7.com.cn/dbd2719600ff6e6a986c66501674e848.jpg!compress", "imageinfo": { "x": 162, "y": 250, "width": 143, "height": 240, "type": "image" } }], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144492985 } },
{ "layout": { "label": "MutipleImage04", "image": [{ "url": "http://img01.cloud7.com.cn/15a7dfe2fbce5646ddcdba86d7995b19.png!compress", "imageinfo": { "x": 131, "y": 47, "width": 58, "height": 30, "animation": "shrink", "type": "text", "text": "初页", "textDirection": "h" } }, { "url": "http://img01.cloud7.com.cn/112d37f1a4e7136b2cf27b1ffe8c4e11.png!compress", "imageinfo": { "x": 95, "y": 87, "width": 130, "height": 21, "animation": "emerge-top", "type": "text", "text": "只为温暖你的心", "textDirection": "h" } }, { "url": "http://img01.cloud7.com.cn/09a5bfec2254895d5a4aefe073794eee.png!compress", "imageinfo": { "x": 90, "y": 121, "width": 140, "height": 16, "animation": "emerge-bottom", "type": "text", "text": "不管这样任性,都是因为爱", "textDirection": "h" } }, { "images": ["http://img01.cloud7.com.cn/51e310717d92ecea943d094b99e8b129.jpg!compress", "http://img01.cloud7.com.cn/8db72c786ab85cef9c22e9f5a43e3b68.jpg!compress", "http://img01.cloud7.com.cn/ae9ca394ee259bd095c099669bb1e8ff.jpg!compress", "http://img01.cloud7.com.cn/371a9a98071ed29cbd09f3f8d4102e38.jpg!compress"], "arrow": "", "imageinfo": { "x": 80, "y": 194, "width": 162, "height": 256, "rotate": 0.04 } }], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144492987 } },
//图字组合
{ "layout": { "label": "ImageText01", "image": [{ "url": "http://img01.cloud7.com.cn/deb8936d9d6ada0b385ad69750fa97a9.jpg!compress", "imageinfo": { "x": 0, "y": 115, "width": 320, "height": 390, "type": "image" } }], "text": ["初页", "在乎你的感受", "所以才用心表达"], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144485236 } },
{ "layout": { "label": "ImageText02", "image": [{ "url": "http://img01.cloud7.com.cn/9888d58b528ab596e42cee4771381bd8.jpg!compress", "imageinfo": { "x": 0, "y": 0, "width": 320, "height": 504, "type": "image" } }], "text": ["初页", "在乎你的感受", "终于等到你"], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144485238 } },
{ "layout": { "label": "ImageText03", "image": [{ "url": "http://img01.cloud7.com.cn/55850592f8719b94c2281b04c387de81.jpg!compress", "imageinfo": { "x": 0, "y": 0, "width": 320, "height": 390, "type": "image" } }], "text": ["初页", "在乎你的感受", "所以才用心表达"], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144485239 } },
//图字组合 字占背景
{ "layout": { "label": "ImageText04", "image": [{ "url": "http://img01.cloud7.com.cn/6797d2ca5468c05f80096011a8e929bd.jpg!compress", "imageinfo": { "x": 0, "y": 115, "width": 320, "height": 390, "type": "image" } }], "text": ["初页", "在乎你的感受", "所以才用心表达"], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144485236 } },
{ "layout": { "label": "ImageText05", "image": [{ "url": "http://img01.cloud7.com.cn/4470201ad4e0a42c13879710659c837f.jpg!compress", "imageinfo": { "x": 0, "y": 0, "width": 320, "height": 504, "type": "image" } }], "text": ["初页", "在乎你的感受", "终于等到你"], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144485238 } },
{ "layout": { "label": "ImageText06", "image": [{ "url": "http://img01.cloud7.com.cn/ded27b4904fe04f89c89d4fed5d68c61.jpg!compress", "imageinfo": { "x": 0, "y": 0, "width": 320, "height": 390, "type": "image" } }], "text": ["初页", "在乎你的感受", "所以才用心表达"], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144485239 } },
//图字组合 方形布局
{ "layout": { "label": "ImageText07", "image": [{ "url": "rgba(255,255,255,1)" }, { "url": "http://img01.cloud7.com.cn/44feb1b1bae41af77385460b734031c4.jpg!compress", "imageinfo": { "x": 0, "y": 115, "width": 320, "height": 390, "type": "image" } }], "text": ["初页", "每一页都美若人生初见"], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144485236 } },
{ "layout": { "label": "ImageText08", "image": [{ "url": "rgba(233,233,233,1)" }, { "url": "http://img01.cloud7.com.cn/ac2588d9697cdeb8e6f1896808c70e5a.jpg!compress", "imageinfo": { "x": 0, "y": 0, "width": 320, "height": 504, "type": "image" } }], "text": ["初页", "每一页都美若人生初见"], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144485238 } },
{ "layout": { "label": "ImageText09", "image": [{ "url": "http://img01.cloud7.com.cn/5906895f52319afa677b67cf8a1d2cad.jpg!compress" }, { "url": "http://img01.cloud7.com.cn/6293525e67f9046b45e7dc187900fdcd.jpg!compress", "imageinfo": { "x": 0, "y": 0, "width": 320, "height": 390, "type": "image" } }], "text": ["初页", "用初页App,选七八张图,落三五\n行字,点选你爱的音乐,数分钟\n内创作出你的专属初页。"], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144485239 } },

//图字组合 字在整个图+连接
{ "layout": { "label": "ImageText10", "image": [{ "url": "http://img01.cloud7.com.cn/08f54fd42648f5e46407352d7f912860.jpg!compress", "imageinfo": { "x": 0, "y": 0, "width": 320, "height": 504, "type": "image" } }], "text": ["【邀请函】\n最具现场感的动态邀请函,有图有音乐有引力。", "【商品\\服务海报】\n最有气质格调的多媒体商品\\服务海报。", "【明星范杂志】\n最立体生动的任务介绍页。女神或女神经,艺术家或企业家——有初页的人,总是不小心就一页成名。"], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144489712 } },
{ "layout": { "label": "ImageText11", "image": [{ "url": "http://img01.cloud7.com.cn/3b2d30656a99552c8f7cebd526292c50.jpg!compress", "imageinfo": { "x": 0, "y": 0, "width": 320, "height": 504, "type": "image" } }], "text": ["谁在用初页?", "“嘉玲姐的后厨房”做了餐厅介绍初页,请微信粉丝与刘嘉玲在维多利亚港畔共品下午茶;\n\n“动吧”团队在初页里问谁是“世界上最任性的人”,揭晓的答案是他们的CEO黄健翔;\n\n还有耳熟能详的电信运营商、汽车厂商、网站、银行、酒店、商城、公益组织、画家、作家,他们都在创作着不同用途的官方初页。"], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144489759 } },
{ "layout": { "label": "Sign-Up02", "image": [{ "url": "http://img01.cloud7.com.cn/eae5e34ec07def1e8f595e620dbc17d6.jpg!compress", "imageinfo": { "x": 0, "y": 0, "width": 320, "height": 504, "type": "image" } }], "actionlinks": ["http://www.cloud7.com.cn/"], "position": ["middle"], "custom": { "type": "y", "animationFirst": "image" }, "pid": 144489718 } }


],


"author": "好麻烦啊希望可以没心没肺的活着", "headimgurl": "http://tp3.sinaimg.cn/2105589650/180/5607401983/1", "copyright": 1, "uid": 9471816
}
};
var imgArry = workArry.data.pages;
var n = 0;
var len = workArry.data.pages.length;
var flag = true;
var removeImg;
$(".div-bg").swipe({
swipeUp: function () {
if (flag) {

flag = false;
removeImg = $(".layout:not(.animation-append)");
n++;
if (n == len) {
n = 0;
}
ss(‘keyup‘, ‘keyup1‘, 0.8);
}

},
swipeDown: function () {
if (flag) {
flag = false;
removeImg = $(".layout:not(.animation-append)");
n--;
if (n == -1) {
n = len * 1 - 1;
}
ss(‘keydown‘, ‘keydown1‘, 0.5);
}
},

})
function ss(keyframes, keyframes1, seconds) {
removeImg.css("-webkit-animation", "" + keyframes + " " + seconds + "s");
var img = getContent(imgArry[n], keyframes1, seconds);
$(".img-container").append(img);
setTimeout(function () {
removeImg.remove();
$(".layout").removeClass("animation-append");
//$(".layout").attr("style", "");
flag = true;
}, 1001)
}

function getContent(myArry, keyframes1, seconds) {
var content = "", imageinfo, images;
var label = myArry.layout.label;
console.log(label);
if (label == "SingleImage") {
content += "<div class=‘layout animation-append‘ style=‘-webkit-animation:" + keyframes1 + " " + seconds + "s‘>";
content += "<img src=‘" + myArry.layout.image[0].url + "‘ />";
content += "</div>";
}
else if (label.indexOf("MutipleImage") >= 0) {


images = myArry.layout.image;

if (label == "MutipleImage01") {
content += "<div class=‘layout animation-append‘ style=‘-webkit-animation:" + keyframes1 + " " + seconds + "s;background:black‘>";
for (var i = 0; i < images.length; i++) {
for (var j = 0; j < myArry.layout.image[i].images.length; j++) {
var imgs = myArry.layout.image[i].images;
imageinfo = myArry.layout.image[i].imageinfo;
var left = "14%";
var top = "8%";
var height = "84%";
var width = "72%";
var rotate = (3 - j * 1) * 4 + "deg";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";border:3px solid white;transform: rotate(" + rotate + ")";
content += "<div style=‘" + style + "‘>";
//content += "<div style=‘position:absolute;left:" + imageinfo.x / conHeight * 100 + "%;top:10%;width:70%;height:80%‘>";
content += "<img src=‘" + images[i].images[j] + "‘ style=‘‘ />";
content += "</div>";
}
}
content += "</div>";
}
else if (label == "MutipleImage02") {
content += "<div class=‘layout animation-append‘ style=‘-webkit-animation:" + keyframes1 + " " + seconds + "s‘>";
for (var i = 0; i < images.length; i++) {
imageinfo = myArry.layout.image[i].imageinfo;
var left = "4%";
var top = i * 30 + 5 + "%";
var height = "30%";
var width = "92%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + "";
content += "<div style=‘" + style + "‘>";
content += "<img src=‘" + images[i].url + "‘ />";
content += "</div>";
}
content += "</div>";
}
else if (label == "MutipleImage03") {
content += "<div class=‘layout animation-append‘ style=‘-webkit-animation:" + keyframes1 + " " + seconds + "s‘>";
for (var i = 0; i < images.length; i++) {
imageinfo = myArry.layout.image[i].imageinfo;
var left = i == 2 ? "50%" : "3%";
var top = i == 0 ? "2%" : "50%";
var height = "47%";
var width = i == 0 ? "94%" : "46%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + "";
content += "<div style=‘" + style + "‘>";
content += "<img src=‘" + images[i].url + "‘ />";
content += "</div>";
}
content += "</div>";
}
else if (label == "MutipleImage04") {
content += "<div class=‘layout animation-append‘ style=‘-webkit-animation:" + keyframes1 + " " + seconds + "s‘>";
for (var i = 0; i < images.length; i++) {
if (myArry.layout.image[i].hasOwnProperty("images")) {
for (var j = 0; j < myArry.layout.image[i].images.length; j++) {
var imgs = myArry.layout.image[i].images;
imageinfo = myArry.layout.image[i].imageinfo;
var left = "20%";
var top = "40%";
var height = "50%";
var width = "60%";
var rotate = (3 - j * 1) * 4 + "deg";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";border:1px solid white;transform: rotate(" + rotate + ")";
content += "<div style=‘" + style + "‘>";
//content += "<div style=‘position:absolute;left:" + imageinfo.x / conHeight * 100 + "%;top:10%;width:70%;height:80%‘>";
content += "<img src=‘" + images[i].images[j] + "‘ style=‘‘ />";
content += "</div>";
}
}
else {
imageinfo = myArry.layout.image[i].imageinfo;
var font = i == 0 ? "1.5em" : i == 1 ? "1em" : "0.8em";
var left = "0px";
var top = i == 0 ? "15%" : i == 1 ? "23%" : "30%";
var height = i == 0 ? "10%" : i == 1 ? "8%" : "5%";
var width = "100%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";text-align:center;font-size:" + font + ";color:gray";
content += "<div style=‘" + style + "‘>";
content += imageinfo.text;
content += "</div>";
}
}
content += "</div>";
}

}
else if (label.indexOf("ImageText") >= 0) {
content += "<div class=‘layout animation-append‘ style=‘-webkit-animation:" + keyframes1 + " " + seconds + "s‘>";
for (var i = 0; i < myArry.layout.image.length; i++) {
if (label == "ImageText01") {
var image = myArry.layout.image[i];
imageinfo = myArry.layout.image[i].imageinfo;
var style = "position:absolute;left:0;top:0;width:100%;height:100%";
content += "<div style=‘" + style + "‘>";
content += "<img src=‘" + image.url + "‘ style=‘‘ />";
content += "</div>";


var left = "0";
var top = "0";
var height = "15%";
var width = "100%";
var style = "position:absolute;padding-top:5%;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";text-align:center;color:white";
content += "<div style=‘" + style + "‘>";
for (var j = 0; j < myArry.layout.text.length; j++) {
var font = j == 0 ? "2em" : j == 1 ? "1em" : "0.8em";
content += "<div style=‘padding:5px;font-size:" + font + "‘>" + myArry.layout.text[j] + "</div>";
}
content += "</div>";
}

else if (label == "ImageText02") {

var image = myArry.layout.image[i];
imageinfo = myArry.layout.image[i].imageinfo;
var style = "position:absolute;left:0;top:0;width:100%;height:100%";
content += "<div style=‘" + style + "‘>";
content += "<img src=‘" + image.url + "‘ style=‘‘ />";
content += "</div>";


var left = "0";
var top = "35%";
var height = "15%";
var width = "100%";
var style = "position:absolute;padding-top:5%;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";text-align:center;color:white";
content += "<div style=‘" + style + "‘>";
for (var j = 0; j < myArry.layout.text.length; j++) {
var font = j == 0 ? "2em" : j == 1 ? "1em" : "0.8em";
content += "<div style=‘padding:5px;font-size:" + font + "‘>" + myArry.layout.text[j] + "</div>";
}
content += "</div>";
}
else if (label == "ImageText03") {
var image = myArry.layout.image[i];
imageinfo = myArry.layout.image[i].imageinfo;
var style = "position:absolute;left:0;top:0;width:100%;height:100%";
content += "<div style=‘" + style + "‘>";
content += "<img src=‘" + image.url + "‘ style=‘‘ />";
content += "</div>";


var left = "0";
var top = "75%";
var height = "15%";
var width = "100%";
var style = "position:absolute;padding-top:5%;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";text-align:center;color:white";
content += "<div style=‘" + style + "‘>";
for (var j = 0; j < myArry.layout.text.length; j++) {
var font = j == 0 ? "2em" : j == 1 ? "1em" : "0.8em";
content += "<div style=‘padding:5px;font-size:" + font + "‘>" + myArry.layout.text[j] + "</div>";
}
content += "</div>";
}
else if (label == "ImageText04") {
var image = myArry.layout.image[i];
imageinfo = myArry.layout.image[i].imageinfo;
var style = "position:absolute;left:0;top:20%;width:100%;height:80%";
content += "<div style=‘" + style + "‘>";
content += "<img src=‘" + image.url + "‘ style=‘‘ />";
content += "</div>";


var left = "0";
var top = "0";
var height = "15%";
var width = "100%";
var style = "position:absolute;padding-top:5%;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";text-align:center;color:black;background:white";
content += "<div style=‘" + style + "‘>";
for (var j = 0; j < myArry.layout.text.length; j++) {
var height = j == 0 ? 25 : j == 1 ? 15 : 9;
content += "<div style=‘padding:5px;height:" + height + "px;font-size:" + height + "px‘>" + myArry.layout.text[j] + "</div>";
}
content += "</div>";

 

}
else if (label == "ImageText05") {
var image = myArry.layout.image[i];
imageinfo = myArry.layout.image[i].imageinfo;
var style = "position:absolute;left:0;top:0;width:100%;height:100%";
content += "<div style=‘" + style + "‘>";
content += "<img src=‘" + image.url + "‘ style=‘‘ />";
content += "</div>";


var left = "0px";
var top = "40%";
var height = "15%";
var width = "100%";
var style = "position:absolute;padding-top:5%;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";text-align:center;color:black;background:white";
content += "<div style=‘" + style + "‘>";
for (var j = 0; j < myArry.layout.text.length; j++) {
var height = j == 0 ? 25 : j == 1 ? 15 : 9;
content += "<div style=‘padding:5px;height:" + height + "px;font-size:" + height + "px‘>" + myArry.layout.text[j] + "</div>";
}
content += "</div>";
}
else if (label == "ImageText06") {
var image = myArry.layout.image[i];
imageinfo = myArry.layout.image[i].imageinfo;
var style = "position:absolute;left:0;top:0;width:100%;height:80%";
content += "<div style=‘" + style + "‘>";
content += "<img src=‘" + image.url + "‘ style=‘‘ />";
content += "</div>";


var left = "0px";
var top = "80%";
var height = "15%";
var width = "100%";
var style = "position:absolute;padding-top:5%;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";text-align:center;color:black;background:white";
content += "<div style=‘" + style + "‘>";
for (var j = 0; j < myArry.layout.text.length; j++) {
var height = j == 0 ? 25 : j == 1 ? 15 : 9;
content += "<div style=‘padding:5px;height:" + height + "px;font-size:" + height + "px‘>" + myArry.layout.text[j] + "</div>";
}
content += "</div>";
}
else if (label == "ImageText07") {
var image = myArry.layout.image[i];
if (image.hasOwnProperty("imageinfo")) {
imageinfo = myArry.layout.image[i].imageinfo;
var left = "0";
var top = "0";
var height = "65%";
var width = "100%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";";
content += "<div style=‘" + style + "‘>";
//content += "<div style=‘position:absolute;left:" + imageinfo.x / conHeight * 100 + "%;top:10%;width:70%;height:80%‘>";
content += "<img src=‘" + image.url + "‘ style=‘‘ />";
content += "</div>";

var left = "0";
var top = "73%";
var height = "25%";
var width = "100%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";text-align:center;";
content += "<div style=‘" + style + "‘>";
content += "<div style=‘padding:5px;font-size:36px;font-weight:bolder;color:orange‘>" + myArry.layout.text[0] + "</div>";
content += "<div style=‘padding:5px;font-size:18px;color:orange‘>" + myArry.layout.text[1] + "</div>";
content += "</div>";
}
else {
imageinfo = myArry.layout.image[i].imageinfo;
var left = "0";
var top = "0";
var height = "100%";
var width = "100%";
var background = "";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";";
if (image.url.indexOf("rgba") >= 0)
style += "background: " + image.url + ";";
content += "<div style=‘" + style + "‘>";
if (image.url.indexOf("rgba") < 0)
content += "<img src=‘" + image.url + "‘ style=‘height:100%;width:100%;‘ />";
content += "</div>";
}
}
else if (label == "ImageText08") {
var image = myArry.layout.image[i];
if (image.hasOwnProperty("imageinfo")) {
imageinfo = myArry.layout.image[i].imageinfo;
var left = "6%";
var top = "10%";
var height = "55%";
var width = "88%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";background:white";
content += "<div style=‘" + style + "‘>";
//content += "<div style=‘position:absolute;left:" + imageinfo.x / conHeight * 100 + "%;top:10%;width:70%;height:80%‘>";
content += "<img src=‘" + image.url + "‘ style=‘position:absolute;left:3%;top:3%;width:94%;height:90%‘ />";
content += "</div>";

var left = "0";
var top = "70%";
var height = "25%";
var width = "100%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";text-align:center;color:orange";
content += "<div style=‘" + style + "‘>";
content += "<div style=‘padding:5px;font-size:36px;font-weight:bolder;color:pink‘>" + myArry.layout.text[0] + "</div>";
content += "<div style=‘padding:5px;font-size:18px;color:gray‘>" + myArry.layout.text[1] + "</div>";
content += "</div>";
}
else {
imageinfo = myArry.layout.image[i].imageinfo;
var left = "0";
var top = "0";
var height = "100%";
var width = "100%";
var background = "";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";";
if (image.url.indexOf("rgba") >= 0)
style += "background: " + image.url + ";";
content += "<div style=‘" + style + "‘>";
if (image.url.indexOf("rgba") < 0)
content += "<img src=‘" + image.url + "‘ style=‘height:100%;width:100%;‘ />";
content += "</div>";
}
}
else if (label == "ImageText09") {
var image = myArry.layout.image[i];
if (image.hasOwnProperty("imageinfo")) {
imageinfo = myArry.layout.image[i].imageinfo;
var left = "6%";
var top = "10%";
var height = "50%";
var width = "88%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";";
content += "<div style=‘" + style + "‘>";
//content += "<div style=‘position:absolute;left:" + imageinfo.x / conHeight * 100 + "%;top:10%;width:70%;height:80%‘>";
content += "<img src=‘" + image.url + "‘ style=‘‘ />";
content += "</div>";

var left = "6%";
var top = "60%";
var height = "35%";
var width = "88%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";text-align:center;background:white;opacity:0.8";
content += "<div style=‘" + style + "‘>";
content += "<div style=‘padding-top:20px;font-size:36px;font-weight:bolder;;‘>" + myArry.layout.text[0] + "</div>";
content += "<div style=‘padding:5px;font-size:18px;‘>" + myArry.layout.text[1].replace(/\n/g, "<br />") + "</div>";
content += "</div>";
}
else {
imageinfo = myArry.layout.image[i].imageinfo;
var left = "0";
var top = "0";
var height = "100%";
var width = "100%";
var background = "";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";";
if (image.url.indexOf("rgba") >= 0)
style += "background: " + image.url + ";";
content += "<div style=‘" + style + "‘>";
if (image.url.indexOf("rgba") < 0)
content += "<img src=‘" + image.url + "‘ style=‘height:100%;width:100%;‘ />";
content += "</div>";
}
}
else if (label == "ImageText10") {
var image = myArry.layout.image[i];
imageinfo = myArry.layout.image[i].imageinfo;
var left = "0";
var top = "0";
var height = "100%";
var width = "100%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";";
content += "<div style=‘" + style + "‘>";
//content += "<div style=‘position:absolute;left:" + imageinfo.x / conHeight * 100 + "%;top:10%;width:70%;height:80%‘>";
content += "<img src=‘" + image.url + "‘ style=‘‘ />";
content += "</div>";

var left = "8%";
var top = "15%";
var height = "73%";
var width = "84%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";text-align:center;background:black;opacity:0.8;letter-spacing:2px;line-height:1.5";
content += "<div style=‘" + style + "‘>";
content += "<div style=‘position:absolute;top:10%;left:10%;font-size:12px;width:80%;height:30%;color:white;text-align:left‘>" + myArry.layout.text[0].replace(/\n/g, "<br />") + "</div>";
content += "<div style=‘position:absolute;top:40%;left:10%;font-size:12px;width:80%;height:30%;color:white;text-align:left‘>" + myArry.layout.text[1].replace(/\n/g, "<br />") + "</div>";
content += "<div style=‘position:absolute;top:70%;left:10%;font-size:12px;width:80%;height:30%;color:white;text-align:left‘>" + myArry.layout.text[2].replace(/\n/g, "<br />") + "</div>";
content += "</div>";

}
else if (label == "ImageText11") {
var image = myArry.layout.image[i];

imageinfo = myArry.layout.image[i].imageinfo;
var left = "0";
var top = "0";
var height = "100%";
var width = "100%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";";
content += "<div style=‘" + style + "‘>";
//content += "<div style=‘position:absolute;left:" + imageinfo.x / conHeight * 100 + "%;top:10%;width:70%;height:80%‘>";
content += "<img src=‘" + image.url + "‘ style=‘‘ />";
content += "</div>";

var left = "23%";
var top = "16%";
var height = "70%";
var width = "56%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";line-height:1.5";
content += "<div style=‘" + style + "‘>";
content += "<div style=‘position:absolute;top:0;left:0;width:100%;height:20%;color:white;font-size:24px;font-weight:600;text-align:center;‘>" + myArry.layout.text[0] + "</div>";
content += "<div style=‘position:absolute;top:20%;left:0;width:100%;height:80%;color:white;font-size:12px;letter-spacing:1px;text-align:left‘>" + myArry.layout.text[1].replace(/\n/g, "<br />") + "</div>";
content += "</div>";

}
}
content += "</div>";
}
else if (label.indexOf("Sign-Up02") >= 0) {
content += "<div class=‘layout animation-append‘ style=‘-webkit-animation:" + keyframes1 + " " + seconds + "s;background:" + myArry.layout.image[0].url + "‘>";

var image = myArry.layout.image[0];
imageinfo = myArry.layout.image[0].imageinfo;
actionlinks = myArry.layout.actionlinks;
var left = "0";
var top = "0";
var height = "100%";
var width = "100%";
var style = "position:absolute;left:" + left + ";top:" + top + ";width:" + width + ";height:" + height + ";";
content += "<div style=‘" + style + "‘>";
content += "<img id=‘img-links‘ src=‘" + image.url + "‘ />";
content += "<div style=‘position:absolute;left:25%;top:35%;height:35%;width:50%;pointer-events:auto;‘ onclick=‘window.open(\"" + actionlinks + "\")‘></div>";
content += "</div>";

content += "</div>";
}
else if (label.indexOf("custom") >= 0) {
content += "<div class=‘layout animation-append‘ style=‘-webkit-animation:" + keyframes1 + " " + seconds + "s;background:" + myArry.layout.image[0].url + "‘>";
for (var i = 0; i < myArry.layout.image.length; i++) {
var image = myArry.layout.image[i];
if (image.url.indexOf("rgba") >= 0) {
if (image.hasOwnProperty("imageinfo")) {
imageinfo = myArry.layout.image[i].imageinfo;
var style = "position:absolute;left:" + imageinfo.x + "px;top:" + imageinfo.y + "px;width:" + imageinfo.width + "px;height:" + imageinfo.height + "px;background:" + image.url + "";
content += "<div style=‘" + style + "‘>";
content += "</div>";
}
}
else {
if (image.hasOwnProperty("imageinfo")) {
imageinfo = myArry.layout.image[i].imageinfo;
var style = "position:absolute;left:" + imageinfo.x + "px;top:" + imageinfo.y + "px;width:" + imageinfo.width + "px;height:" + imageinfo.height + "px";
content += "<div style=‘" + style + "‘>";
content += "<img src=‘" + image.url + "‘ style=‘‘ />";
content += "</div>";
}

}
}
content += "</div>";
}
return content;
}
</script>

测试代码

标签:

原文地址:http://www.cnblogs.com/-maomao/p/5057846.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!