· Simple way to realize the reward function
You can check out my personal homepage, see the effect -> www.yansongsong.cn/
Personal website github address: github.com/xiaosongshi…
In personal website blog, reward sponsorship is a kind of support and encouragement to the author, is a very common function. This article will share a very simple way to implement the tipping function.
Practice demonstration:
1 PC:
(2) the mobile end
Function implementation
Function implementation is very simple, no need to separate the introduction of external CSS and JS, just need to add the following HTML code to your web page:
<script src="http://static.tctip.com/tctip-1.0.0.min.js"></script>
<script>
new tctip({
top: '20%'.button: {
id: 9.type: 'dashang',},list: [{type: 'alipay'.qrImg: 'Your Alipay qr code photo address'
}, {
type: 'wechat'.qrImg: 'Your wechat qr code photo address'
}
]
}).init()
</script>
Copy the code
Parameters that
-
top
type
: StringThe default value
:10%
meaning
: The distance between the top of the plug-in and the top of the pagenote
: format such as100px
or10%
-
button
-
Type: Object, containing two subarrays of ID and Type
-
id
:type
: NumberThe default value
:1
meaning
: represents the color of the picturenote
: The value ranges from 1 to 9
-
type
:type
: StringThe default value
:dashang
meaning
: Chinese characters on the button, yesexceptional
andsponsorship
Two kinds ofnote
: can takedashang
orzanzhu
-
-
list
-
Type: Array
-
Default value: []
-
Description: Key configuration, the right side of the reward display, cannot be empty
-
Note: A maximum of five elements can be passed into an array, and each element has the following configurations
-
type
:type
: StringThe default value
: nomeaning
: Reward typenote
: The system comes with four default types.alipay
.wechat
.bitcon
.tenpay
If it’s not one of these four, you can write whatever you want
-
qrImg
:type
: StringThe default value
: nomeaning
: Qr code picture addressnote
: Trim as much white space around the image as possible.Important but not essential
-
qrContent
:type
: StringThe default value
: nomeaning
: Content of QR codenote
And:qrImg
One of the two must be passed. If this parameter is passed in, the plug-in automatically generates a QR code
-
icon
:type
: StringThe default value
: nomeaning
: icon, listed in the Alipay iconnote
: If type is one of the default four types, omit this parameter
-
name
:type
: StringThe default value
: nomeaning
: Payment name, such as Alipay, wechat, etcnote
: If type is one of the default four types, omit this parameter
-
desc
:type
: StringThe default value
: nomeaning
: A phrase below the TWO-DIMENSIONAL code, similarDo me a favor
Such asnote
: If type is one of the default four types, omit this parameter
-
-
stat
type
: BooleanThe default value
: truemeaning
: Indicates whether to report the statisticsnote
: This parameter is just for the convenience of the author to count the usage of the plug-in
Welcome to visit myThe home pageTry it, if you think it helps, please give it a little encouragement.