html5桌面打开网页是有问号,点击HTML页面问号出现提示框

本demo的功能:点击页面按钮在其边缘出现提示信息,点击页面任何一处则消失。

如下图:

399fc3097ec9af255e35c6288d6ed4b4.png

1.所需插件:

jquery插件;

layer插件;

2.html内容:

==注意==:

class="j-help-tips"这个class是核心,不可缺少。

data-tips属性是必须的。

data-tips属性中:type:"1"不用修改;

data-tips属性中:txt内容即是要提示的内容。

$(function(){

var tips = new helptips().init();

})

3.css内容:(非必要)

本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内容:(核心)

//定义提示弹出框;

var helptipslayer;

//定义弹出框的默认设置;

function helptips(t) {

this.options = {},

this.options.elem = ".j-help-tips", //与页面class相对应;

this.options.type = 1,

this.options.color = "#8db3d7",

this.options.time = 0, //设置0是提示弹出框不会自动消失;可设置为其他数字,以毫秒为单位;

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() {

//点击页面任何一处可使提示弹出框消失;

$(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);//点击其他任意的提示框按钮,则关闭上一个提示框。

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 = '

',

n = '

' + o.title + t.options.titleend + '

s = "

",

l = '

  • ',

p = o.txt.split("|"),

a = p.length;

a > 0 && $.each(p, function(t, i) {

l += '

' + (t + 1) + "" + i + ""

});

var r = /^[1-9][\d]{0,2}$/,

c = t.options.imgwidth,

d = t.options.imgheight;

"undefined" != typeof o.w && "undefined" != typeof o.h && r.test(o.w) && r.test(o.h) && (c = o.w, d = o.h), l += '

' + (a + 1) + " +%20o.img%20+%20'%20width=', l += "";

var h = e + n + l + s;

layer.open({

title : !1,

type : 1,

area : [ t.options.width, t.options.height ],

shadeclose : !0,

maxmin : !1,

move : !1,

scrollbar : !1,

content : h

})

} else {

t.log()

}

}

})

},

log : function() {

console.log("请给定提示标题|文字|图片---来自[script.js]函数[helptips]")

}

};

附上源码下载:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值