圖1
圖2
圖3
在前段頁面制作中,一個選項卡往往需要加載的內(nèi)容會很多,例如一些圖片站和特效站點,過長的加載和不完整的加載會給讀者很不好的體驗,這時候,如果我們在加載的過程中加入一個小小的設(shè)定,就是接下來要給大家展現(xiàn)的,loading等待加載提示,大家可以自由發(fā)揮把加載美化城進(jìn)度條也,用戶體驗會更好一些。
不多羅嗦大家看效果吧
完成源碼:(ps:js文件真心貼不出來,小編也很苦惱,需要還是留郵箱吧,小編保證,只是發(fā)源碼,絕不廣告騷擾)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jquery css3頁面彈出loading加載</title>
</head>
<body>
<style type="text/css">
/* reset */
*{margin:0;padding:0;list-style-type:none;}
a{blr:expression(this.onFocus=this.blur())}/*去掉a標(biāo)簽的虛線框,避免出現(xiàn)奇怪的選中區(qū)域*/
:focus{outline:0;}
label{cursor:pointer;}
img{vertical-align:middle;}
table{empty-cells:show;border-collapse:collapse;border-spacing:0;}
h1{font-size:16px;}h2,h3,h4{font-size:14px;}h5,h6{font-size:12px;}
abbr,acronym{border:0;font-variant:normal}
address,caption,cite,code,dfn,em,th,var,optgroup{font-style:normal;font-weight:normal}
input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit}
input,button,textarea,select{*font-size:100%}
a,img{border:0;}
a,a:visited{color:#5e5e5e; text-decoration:none;}
a:hover{color:#4183C4;text-decoration:underline;}
.clear{display:block;overflow:hidden;clear:both;height:0;line-height:0;font-size:0;}
.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
.clearfix{display:inline-table;}/* Hides from IE-mac \*/
*html .clearfix{height:1%;}
.clearfix{display:block;}/* End hide from IE-mac */
*+html .clearfix{min-height:1%;}
body{font:12px/180% Arial,Lucida,Verdana,"宋體",Helvetica,sans-serif;color:#333;background:#fff;}
/* shortcut */
.shortcut{height:32px;line-height:32px;font-size:12px;background:#eee;text-transform:uppercase;box-shadow:1px 0px 2px rgba(0,0,0,0.2);border-bottom:1px solid #DDDDDD;}
.shortcut h1{font-size:14px;font-family:"微軟雅黑","宋體";}
.shortcut a,.shortcut h1{padding:0px 10px;letter-spacing:1px;color:#333;text-shadow:0px 1px 1px #fff;display:block;float:left;width:360px;height:32px;overflow:hidden;}
.shortcut a:hover{background:#fff;}
.shortcut span.right{float:right;display:inline-block;width:468px;height:15px;overflow:hidden;margin:8px 5px 0 0;}
.shortcut .close{
background:url(/Public/images/close-demo.gif) no-repeat 0 0;width:20px;height:20px;line-height:99em;overflow:hidden;display:inline-block;margin:6px 10px 0 10px;float:right;padding:0;
-webkit-transition:all .3s ease-out 0s;
-moz-transition:all .3s ease-out 0s;
-ms-transition:all .3s ease-out 0s;
-o-transition:all .3s ease-out 0s;
transition:all .3s ease-out 0s;
}
.shortcut .close:hover{background:url(/Public/images/close-demo.gif) no-repeat 0 -20px}
.shortcut .close:active{background:url(/Public/images/close-demo.gif) no-repeat 0 -40px}
</style>
<script type="text/javascript" src="./jquery css3頁面彈出loading加載代碼_files/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var iframeHeight=function () {
var _height=$(window).height() - 34;
$('#content').height(_height);
}
window.onresize=iframeHeight;
$(function () {
iframeHeight();
});
});
</script>
<div id="container" style="overflow:hidden;">
<iframe border="0" id="content" src="./jquery css3頁面彈出loading加載代碼_files/index.html" frameborder="0" height="100%" width="100%" style="height: 577px;"></iframe>
</div>
<script type="text/javascript">
var _bdhmProtocol=(("https:"==document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F382f81c966395258f239157654081890' type='text/javascript'%3E%3C/script%3E"));
</script>
<script src="./jquery css3頁面彈出loading加載代碼_files/h.js" type="text/javascript"></script>
</body>
</html>
了避免誤刪數(shù)據(jù),刪除前應(yīng)該不要嫌麻煩彈出一個確認(rèn)/取消詢問窗口,以前免錯刪數(shù)據(jù)后無法恢復(fù)。網(wǎng)站的數(shù)據(jù)刪除由用 戶在客戶端發(fā)起,所以彈出確認(rèn)/取消詢問窗口由javascript來完成,它彈出的詢問窗口跟Windows系統(tǒng)彈出的一樣。
javascript刪除前彈出一個確認(rèn)/取消詢問窗口有幾種方法,我們只介紹一種方便調(diào)用的方法,這樣既便于在 javascript 代碼中調(diào)用,又便于在 html 文件中調(diào)用。
一、javascript刪除前彈出確認(rèn)/取消詢問窗口方法
為了方便調(diào)用,我們把它封裝成一個方法(函數(shù)),以下就是具體代碼:
從以上的刪除代碼來看,是使用了 windows 的 confirm 方法。confirm 括號中的“你確定要刪除嗎?”是彈 出詢問窗口問用戶的文字,可以根據(jù)自己的要求修改,當(dāng)用戶確認(rèn)要刪除(即單擊了“確認(rèn)”按鈕),返回真;當(dāng)用戶取消 刪除(單擊了“取消”按鈕),返回假。
二、應(yīng)用舉例(javascript刪除前彈出確認(rèn)/取消詢問窗口方法)
假如用戶選中了幾條要刪除的產(chǎn)品記錄,用戶單擊“刪除”后立即彈出一個“確認(rèn)/取消”詢問窗 口,只有用戶選擇“確認(rèn)”后才刪除,否則不刪除,具體代碼如下:
只要在每個要刪除數(shù)據(jù)的javascript方法中直接調(diào)用刪除前詢問方法就可以了;當(dāng)它返回真,執(zhí)行刪除操作,否則不刪除 數(shù)據(jù)。
*請認(rèn)真填寫需求信息,我們會在24小時內(nèi)與您取得聯(lián)系。