本demo的功能:點(diǎn)擊頁(yè)面按鈕在其邊緣出現(xiàn)提示信息,點(diǎn)擊頁(yè)面任何一處則消失。
如下圖:
jquery插件;
layer插件;
2.HTML內(nèi)容:==注意==:
>
data-tips屬性是必須的。
data-tips屬性中:type: 1 不用修改;
data-tips屬性中:txt內(nèi)容即是要提示的內(nèi)容。
html head link rel= stylesheet href= style.css type= text/css / /head body div >3.css內(nèi)容:(非必要)本demo的css非必須,不影響功能;
.edi-icon { font-size: 18px; font-style: normal; -webkit-font-smoothing: antialiased; -webkit-text-stroke-width: .2px; -moz-osx-font-smoothing: grayscale; *display: inline; *zoom: 1; cursor: pointer;}4.javascript內(nèi)容:(核心)//定義提示彈出框;var helpTipsLayer;//定義彈出框的默認(rèn)設(shè)置;function helpTips(t) { this.options = {}, this.options.elem = .j-help-tips , //與頁(yè)面class相對(duì)應(yīng); this.options.type = 1, this.options.color = #8db3d7 , this.options.time = 0, //設(shè)置0是提示彈出框不會(huì)自動(dòng)消失;可設(shè)置為其他數(shù)字,以毫秒為單位; this.options.titleEnd = 錄入提示 , this.options.width = 600px , this.options.height = , this.options.imgWidth = 233 , this.options.imgHeight = 375 , undefined != typeof t (this.options = $.extend({}, this.options, t)), this.elemObj = $(this.options.elem)function() { //點(diǎn)擊頁(yè)面任何一處可使提示彈出框消失; $(document).on( click , function(event){ var e = event || window.event; var target = e.target || e.srcElement; var flag = $(target).hasClass( j-help-tips if(helpTipsLayer !flag){ layer.close(helpTipsLayer);}(), helpTips.prototype = { constructor : helpTips, init : function() { this.bindEvent() bindEvent : function() { var t = this; t.elemObj.on( click , function() { layer.close(helpTipsLayer);//點(diǎn)擊其他任意的提示框按鈕,則關(guān)閉上一個(gè)提示框。 var i = $(this), o = i.data( tips if ( undefined != typeof o undefined != typeof o.type 1 == o.type) { undefined != typeof o undefined != typeof o.txt ? helpTipsLayer = layer.tips(o.txt, i, { tips : [ t.options.type, t.options.color ], time : t.options.time }) : t.log() } else { if ( undefined != typeof o.title undefined != typeof o.txt undefined != typeof o.img) { var e = p >以上就是點(diǎn)擊HTML頁(yè)面問(wèn)號(hào)出現(xiàn)提示框(附源碼)的詳細(xì)內(nèi)容,html教程
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。
新聞熱點(diǎn)
疑難解答
圖片精選