前端只需引用:
<link href="js/floating.css" rel="stylesheet" type="text/css"> <script src="css/floating.js"></script>
js
<script>
$(document).ready(function() {
$("body").floating({
"theme": "panel_theme_fillet_Blacktheme",
"state": true,
"moveState": true,
"size": "sm",
"position": "right-center",
"tip": {
"background-color": "#f20000",
"color": "#efb2b2"
},
"account": [{
"type": "Email",
"tip": null,
"text": null,
"url": "mailto:null"
}, {
"type": "Phone",
"tip": null,
"text": null,
"url": "tel:null"
}, {
"type": "Skype",
"tip": null,
"text": null,
"url": "skype:null?chat"
}, {
"type": "WhatsApp",
"tip": null,
"text": null,
"url": "https://api.whatsapp.com/send?phone=null"
}, {
"type": "Viber",
"tip": null,
"text": null,
"url": "viber://tel:null"
}, {
"type": "QRcode",
"tip": "https://www.***.com/css/images/12.jpg",//二维码图片地址
"text": null,
"url": null
}, {
"type": "Top",
"tip": "Back top",
"text": null,
"url": null
}, {
"type": "QQ",
"tip": null,
"text": "213123",
"url": "http://wpa.qq.com/msgrd?v=3&uin=213123&site=qq&menu=yes"
}]
});
}) <
</script>json:
var initialize = {
theme: "panel_theme_round_solid", //主题
state: true, //PC
moveState: true, //移动
size: "auto", //尺寸
position: "right-center", //展示位置
tip: {
"background-color": "#000",
"color": "#fff"
}, //提示层的样式
account: [ //悬浮部件
{
type: "Email",
tip: "",
text: "",
url: ""
}, {
type: "Phone",
tip: "",
text: "",
url: ""
}, {
type: "Skype",
tip: "",
text: "",
url: ""
}, {
type: "WhatsApp",
tip: "",
text: "",
url: ""
}, {
type: "Viber",
tip: "",
text: "",
url: ""
},
{
type: "QRcode",
tip: "https://***/css/images/12.jpg"
}, {
type: "Top",
tip: "Back top"
}
]
};后台编辑器插件为任务需求编写封装,
$("body").floatmodel(initialize);后台编辑器获取组合好的前端悬浮JSON: 获取JSON:
$("body").floatmodel("get");前端调用:
$("body").floating(initialize);