js循环遍历弹框,先弹出第一个之后逐步弹出第二个。。
var data = [{ "login_advertTitle": "即使生活琐碎,也要活得优雅", "login_advertCont": "<html>\r\n<head>\r\n\t<title></title>\r\n</head>\r\n<body>\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\">Who can say that their lives are not insignificant?</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> 谁的生活不琐碎呢?</p>\r\n\r\n<center style=\"padding: 0px; margin: 0px; color: rgb(51, 51, 51); font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);\"><img alt=\"唯美图片\" height=\"371\" src=\"https://www.yueduwen.com/uploads/allimg/1802/1-1P20320593L18.jpg\" style=\"padding: 0px; margin: 0px 0px 10px; border: none; box-shadow: rgb(174, 174, 174) 2px 3px 3px;\" width=\"600\" /></center>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> Everyone's life is composed with one after another insignificant day.</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> 我们的一生,都是由这一个个琐碎的一天构成的。</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> Some people got their willpower abraded in this endless loop of days.</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> 有的人在这日复一日的循环中被消磨了意志。</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> They think this is how things can only be like.<span class=\"yueduwencom\" style=\"padding: 0px; margin: -30px 0px 0px; position: relative; top: -5000px; left: -10000px; display: block;\">(<a href=\"http://www.yueduwen.com/\" style=\"padding: 0px; margin: 0px; color: rgb(0, 112, 192);\">悦读文网</a> www.yueduwen.com)</span></p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> 认为一切也就这样了。</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> So they choose to reach a compromise and become mediocre. They become the background colors in others' eyes. They won't achieve anything great to be written down in history, nor can they bring any enjoyment to the people around them.</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> 于是他们选择与平庸妥协,成为别人眼中的背景颜色,不光不会在历史上留下一笔伟绩,甚至无法为身边的人平添一抹色彩。</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> They are alive, but deep down in their hearts something important has died.</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> 他们活着,但他们心中的一部分已经死了。</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> And there are another kind of people. They choose to live with dignity.</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> 而另一些人,他们依旧选择有尊严地活着。</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> A graceful lifestyle is not a show for others to watch. You live it because you deserve it. Through it, you are avoiding to become a victim of this cruel world.</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> 优雅的生活方式并不是为别人做的表演,而是为了对得起自己,让自己不会成为无情社会摧残下的牺牲品。</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> This kind of people know how to find joy in simple things. They know how to make a common day safisticated and meaningful.</p>\r\n\r\n<center style=\"padding: 0px; margin: 0px; color: rgb(51, 51, 51); font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; font-size: 16px; background-color: rgb(255, 255, 255);\"><img alt=\"唯美图片\" height=\"371\" src=\"https://www.yueduwen.com/uploads/allimg/1802/1-1P2032100022V.jpg\" style=\"padding: 0px; margin: 0px 0px 10px; border: none; box-shadow: rgb(174, 174, 174) 2px 3px 3px;\" width=\"600\" /></center>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> 他们懂得如何去发掘单纯事物中的喜悦,懂得如何将平凡的时光过得精致而充实。</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> Life has denied them some beauty. But they build them with their own hands.</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> 那份生活中缺失的美丽,他们靠自己的双手创造了出来。</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> So which kind of these two are you? And which kind are you willing to be?</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> 你的人生是哪种?你想过哪一种?</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> Have you find the answer?</p>\r\n\r\n<p style=\"padding: 10px 0px; margin: 0px; color: rgb(67, 67, 67); font-size: 16px; line-height: 2; text-indent: 2em; font-family: -apple-system, "PingFang SC", "Helvetica Neue", STHeiti, "Microsoft Yahei", Tahoma, sans-serif; background-color: rgb(255, 255, 255);\"> 你找到答案了吗?</p>\r\n</body>\r\n</html>\r\n", "login_advertTime": "15000", "login_adverClose": "1" }, { "login_advertTitle": "aaaaaaa", "login_advertCont": "<html>\r\n<head>\r\n\t<title></title>\r\n</head>\r\n<body>asdasdasassdas d<br />\r\n<img alt=\"\" src=\"/jeecg/upload//1534303323463.jpg\" style=\"width: 250px; height: 275px;\" /><br />\r\n99999999999999</body>\r\n</html>\r\n", "login_advertTime": "15000", "login_adverClose": "1" }];
var i = 0;
// 添加计时器 var time = setInterval(function () { if (i >= data.length) { clearInterval(time); } else { OpenAdvert(data[i].login_advertTitle, data[i].login_advertCont, data[i].login_advertTime, data[i].login_adverClose); i++; } }, 5000);
//弹出广告信息 function OpenAdvert(title, con, time, close) { layer.open({ type: 1, title: title, fix: false, shadeClose: true, offset: 'rb', anim: 2, maxmin: true, area: ['1000px', '500px'], content: con, shade: 0, shadeClose: true, time: time, cancel: function (index, layero) { // 判断是否强制关闭 if (close == 1) { return true; } else if (close == 0) { return false; } } }); }