基于jQuery Tipso插件實(shí)現(xiàn)消息提示框特效
更新時(shí)間:2016年03月16日 11:32:21 投稿:lijiao
這篇文章主要介紹了基于jQuery Tipso插件實(shí)現(xiàn)消息提示框特效,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
基于jQuery Tipso插件實(shí)現(xiàn)消息提示框的特點(diǎn)是可以定義提示框的顯示位置,以及動態(tài)改變提示框的提示內(nèi)容,應(yīng)該說是一款相當(dāng)靈活的jQuery消息提示框插件,分享給大家供大家參考,具體內(nèi)容如下

實(shí)現(xiàn)的代碼:
<div class="dowebok">
<h2>
1、默認(rèn)</h2>
<div class="inner">
<span id="tip1" data-tipso="dowebok.com">Tipso</span></div>
</div>
<div class="dowebok">
<h2>
2、左邊顯示</h2>
<div class="inner">
<span id="tip2" data-tipso="dowebok.com">Tipso</span></div>
</div>
<div class="dowebok">
<h2>
3、背景顏色</h2>
<div class="inner">
<span id="tip3" data-tipso="dowebok.com">Tipso</span></div>
</div>
<div class="dowebok">
<h2>
4、使用title屬性</h2>
<div class="inner">
<span id="tip4" title="內(nèi)容來自 title 屬性">Tipso</span></div>
</div>
<div class="dowebok">
<h2>
5、單擊顯示/隱藏</h2>
<div class="inner">
<span id="tip5" data-tipso="dowebok">Tipso</span>
<p>
<a id="btn5" href="javascript:">顯示</a></p>
</div>
</div>
<div class="dowebok">
<h2>
6、更新內(nèi)容</h2>
<div class="inner">
<span id="tip6" data-tipso="dowebok.com">Tipso</span>
<p>
<input type="text"><a id="btn6" href="javascript:">更新</a></p>
</div>
</div>
<div class="dowebok">
<h2>
7、在圖片上使用</h2>
<div class="inner">
<img id="tip7" src="images/tipso.png" alt="" data-tipso="dowebok.com">
</div>
</div>
<div class="dowebok">
<h2>
8、回調(diào)函數(shù)</h2>
<div class="inner">
<span id="tip8" data-tipso="dowebok.com">Tipso</span>
<p>
狀態(tài):<em id="status"></em></p>
</div>
</div>
js代碼:
$(function () {
// 1
$('#tip1').tipso({
useTitle: false
});
// 2
$('#tip2').tipso({
useTitle: false,
position: 'left'
});
// 3
$('#tip3').tipso({
useTitle: false,
background: 'tomato'
});
// 4
$('#tip4').tipso();
// 5
$('#tip5').tipso({
useTitle: false
});
$('#btn5').on({
click: function (e) {
if ($(this).text() == '顯示') {
$(this).text('隱藏');
$('#tip5').tipso('show');
} else {
$(this).text('顯示');
$('#tip5').tipso('hide');
}
e.preventDefault();
}
});
// 6
$('#tip6').tipso({
useTitle: false
});
$('#btn6').on('click', function () {
var $val = $(this).prev().val();
if ($val) {
$('#tip6').tipso('update', 'content', $val);
}
});
// 7
$('#tip7').tipso({
useTitle: false
});
// 8
$('#tip8').tipso({
useTitle: false,
onBeforeShow: function () {
$('#status').html('beforeShow');
},
onShow: function () {
$('#status').html('show');
},
onHide: function () {
$('#status').html('hide');
}
});
});
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助。
您可能感興趣的文章:
相關(guān)文章
jQueryUI如何自定義組件實(shí)現(xiàn)代碼
第一次自定義jQueryUI Widget 又是第一次,現(xiàn)在的感受是jQueryUI Widget能讓你代碼組織得更好,風(fēng)格更一致。2010-11-11
jQuery Mobile漏洞會有跨站腳本攻擊風(fēng)險(xiǎn)
人們經(jīng)常將跨站腳本攻擊(Cross Site Scripting)縮寫為CSS,但這會與層疊樣式表(Cascading Style Sheets, CSS)的縮寫混淆。因此有人將跨站腳本攻擊縮寫為XSS。2017-02-02
基于jQuery的一個(gè)擴(kuò)展form序列化到j(luò)son對象
jQuery沒有直接支持form到j(luò)son的序列化方法,目前網(wǎng)上有一個(gè)實(shí)現(xiàn)是這樣的2010-12-12

