消息轮播js弹层效果

<div id="toast" style="position: fixed; z-index: 999; top: 10%; background: ; text-align: center; width: 100%; display:none;">
 <span id="toast_content" style="border-radius: 32px;background:rgba(0,0,0,.7);opacity: 0.9;padding: 8px 16px;font-size: 14px;color:#fff;"></span>
 </div>
 <script type="text/javascript">
 /* 消息提醒 */
 var area = ['北京', '广州', '郑州', '武汉', '珠海', '长沙', '淄博', '东莞', '昆山', '无锡', '阳江', '钦州', '天津', '厦门', '深圳', '株洲', '达州', '成都', '重庆', '北海', '福州', '梧州', '青海'];
 var person = ['赵先生', '吴先生', '高先生', '郑先生', '刘先生', '王先生', '刘先生', '李先生', '罗先生', '罗先生', '黄先生', '孙先生', '朱先生', '何先生', '朱先生', '白先生', '陈先生', '邓先生', '叶先生'];
 function showToast() {
 var areaIndex = Math.round(Math.random() * (area.length - 1));
 var personIndex = Math.round(Math.random() * (person.length - 1));
 $("#toast_content").text("来自" + area[areaIndex] + "的" + person[personIndex] + "购买了该产品");
 $("#toast").fadeIn();
 setTimeout("dismissToast()", 1500);
 }
 
 function dismissToast() {
 $("#toast").fadeOut();
 setTimeout("showToast()", 1500 + Math.round(Math.random() * 10000));
 }
 dismissToast();
</script>

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注