按下按钮,有一个加载弹出窗口,然后更改弹出文本
Press button, have a loading popup then change popup text
我有一个按钮,当有人点击它时,我想在那里弹出一个框(我已经做到了),但在它弹出之前,我想加载一个下面有文本的圆圈,它在3秒后弹出。
这可能吗?
当前代码:
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">
<div class="btn">Win!</div>
</a>
<div id="light" class="white_content">Congratulations, you've won!<br>Claim your prize now by completing a short survey:<br>
<input type="submit" value="Complete Survey" onclick="location.href='http://mobverify.com/cl.php?id=5c78fd59851bf0c4867c008c9882d808'">
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'"></a>
</div>
弹出窗口样式:
.white_content {
display: none;
position: absolute;
top: 25%;
left: 25%;
width: 50%;
height: 150%;
padding: 16px;
border: 2px solid white;
background-color: #2e3141;
z-index:1002;
overflow: auto;
text-align: center;
color: white;
border-radius: 30px;
}
只需在代码中添加以下CSS即可。CSS:-
.btn {
width: 316px;
height: 316px;
}
.btn:active{ background:url(http://www.cuisson.co.uk/templates/cuisson/supersize/slideshow/img/progress.BAK-FOURTH.gif) no-repeat;
}
在这种情况下,您应该在点击时使加载程序图像可见,并使用超时功能在3秒钟后执行弹出打开功能。
一个小例子:
var timeout;
function startLoader(){
document.getElementById('loader').className = '';
timeout = setTimeout(openPopup, 3000);
return false;
}
function openPopup() {
document.getElementById('light').style.display = 'block';
document.getElementById('loader').className = 'hidden';
clearTimeout(timeout);
}
function closePopup() {
document.getElementById('light').style.display = 'none';
clearTimeout(timeout);
return false;
}
.white_content {
display: none;
position: absolute;
top: 25%;
left: 25%;
width: 50%;
height: 150%;
padding: 16px;
border: 2px solid white;
background-color: #2e3141;
z-index: 1002;
overflow: auto;
text-align: center;
color: white;
border-radius: 30px;
}
.hidden {
display: none
}
#loader {
background: url(http://www.pointoffshore.com/SiteAssets/loading.gif) no-repeat center center;
height: 50px;
width: 50px;
}
<a href="#" onclick="startLoader()">
<div class="btn">Win!</div>
<div id="loader" class="hidden"> </div>
</div>
</a>
<div id="light" class="white_content">Congratulations, you've won!
<br>Claim your prize now by completing a short survey:
<br>
<input type="submit" value="Complete Survey" onclick="location.href='http://mobverify.com/cl.php?id=5c78fd59851bf0c4867c008c9882d808'">
<a href="#" onclick="closePopup()">close</a>
</div>
相关文章:
- 让文本输入幻灯片显示输入时的新文本输入?然后向后滑动
- ThreeJS将画布中的文本渲染为纹理,然后应用于平面
- 需要使用javascript获取输入文本,然后将其添加到句子中
- 我想重定向点击,然后更改按钮文本,我该怎么做
- 如何停止字幕文本一段时间,然后继续
- 如何放置ÅÄ和#214;在javascript数组中,然后将其与html文本进行比较
- Javascript重复模式匹配,然后输出到文本区域
- 如何删除元素的结束标记,添加一些文本,然后重新添加标记
- HTML表单选项(是或否)然后下拉文本区域
- 在HTML文本框中查找某些子字符串,然后用其他字符串替换它们
- 创建一个bookmarklet,可以检索文本框的所有最大长度,然后在表中打印id和最大长度
- 从文本框中附加url,然后使用javascript打开新窗口
- 如何检测移动浏览器(PHP/Javascript),然后进行图像/文本更改
- 文本框和选择框组合单个文本中的值(第一个tb值,然后是sb值)
- 如果所有三个文本框<>然后是100%
- 无法更新 Javascript 对象文本中的值,然后更新页面
- Chrome扩展程序获取DOM文本并在弹出窗口中显示.html然后单击按钮
- 如何将标签 ID 作为参数传递给 javascript 函数,然后根据需要获得不同标签的文本
- Javascript:从网页中获取文本,更改它,然后再次显示网页
- 从文本区域中获取一个值,然后将其粘贴到另一个窗口中