ASP.NET MVC+Bootstrap个人博客之文章打赏(六)
liuian 2024-12-30 05:16 54 浏览
看到新浪微博、百度百家等等平台上都带有文章“打赏”功能,觉得很新鲜,于是也想在自己的博客中加入“打赏”功能。
当然,加入打赏功能并非是真的想要让别人打赏。因为只有那些真正能引起共鸣,发人深思,让人受益匪浅的文章才值得打赏,值得点赞。
而我的博客站仅仅是用作记录笔记,当做自己的知识库(如果能不经意间帮助别人那是再好不过了)。
加入打赏功能纯粹是“觉得好玩”,就是这么简单,Just have a fun!(博主喜欢折腾,看见一个酷炫的功能就想去实现它)
先看一下这个打赏的Icon长什么样吧! 去站点试试打赏?=>www.zynblog.com
点击“打赏Icon”后会弹出一个二维码界面,各位老板可以选择使用是使用支付宝打赏还是微信打赏:
具体代码如下:(时间仓促,并为将其扩展为插件)
HTML:
<!--打赏按钮-->
<div style="margin-bottom:20px;">
<a title="打赏,支持一下" class="dashang" onclick="dashangToggle" href="javascript:void(0)">
</a>
</div>打赏遮罩层HTML:
<div class="content">
<div class="hide_box"><!--遮罩--></div>
<div class="shang_box">
<a class="shang_close" href="javascript:void(0)" onclick="dashangToggle" title="关闭">
<img src="/Content/dashangimg/close.jpg" alt="取消">
</a>
<div class="shang_tit">
<p>感谢您的支持,我会继续努力的!</p>
</div>
<div class="shang_payimg">
<img src="/Content/dashangimg/alipayimg.jpg" alt="扫码支持" title="扫一扫">
</div>
<div class="pay_explain">扫码打赏,你说多少就多少</div>
<div class="shang_payselect">
<div class="pay_item checked" data-id="alipay">
<span class="radiobox"></span>
<span class="pay_logo">
<img src="/Content/dashangimg/alipay.jpg" alt="支付宝">
</span>
</div>
<div class="pay_item" data-id="weixinpay">
<span class="radiobox"></span>
<span class="pay_logo">
<img src="/Content/dashangimg/wechat.jpg" alt="微信">
</span>
</div>
</div>
<div class="shang_info">
<p>打开<span id="shang_pay_txt">支付宝</span>扫一扫,即可进行扫码打赏哦</p>
</div>
</div>
</div>主要的JS:
//打赏
jQuery(".pay_item").click(function {
jQuery(this).addClass('checked').siblings('.pay_item').removeClass('checked');
var dataid = jQuery(this).attr('data-id');
jQuery(".shang_payimg img").attr("src", "/Content/dashangimg/" + dataid + "img.jpg");
jQuery("#shang_pay_txt").text(dataid == "alipay" ? "支付宝" : "微信");
});
function dashangToggle {
jQuery(".hide_box").fadeToggle;
jQuery(".shang_box").fadeToggle;
};
顺带提供CSS:
1 .hide_box {
2 z-index: 999;
3 filter: alpha(opacity=50);
4 background: #666;
5 opacity: 0.5;
6 -moz-opacity: 0.5;
7 left: 0;
8 top: 0;
9 height: 99%;
10 width: 100%;
11 position: fixed;
12 display: none;
13 }
14
15 .shang_box {
16 width: 540px;
17 height: 540px;
18 padding: 10px;
19 background-color: #fff;
20 border-radius: 10px;
21 position: fixed;
22 z-index: 1000;
23 left: 50%;
24 top: 50%;
25 margin-left: -280px;
26 margin-top: -280px;
27 border: 1px dotted #dedede;
28 display: none;
29 }
30
31 .shang_box img {
32 border: none;
33 border-width: 0;
34 }
35
36 .dashang {
37 display: block;
38 margin: 5px auto;
39 text-align: center;
40 transition: all 0.3s;
41 width:50px;
42 height:50px;
43 background: url(../dashangimg/dashang.png) no-repeat scroll 0% 0% transparent;
44 }
45
46 .dashang:hover {
47 background: url(../dashangimg/dashanghover.png) no-repeat scroll 0% 0% transparent;
48 }
49
50 .shang_close {
51 float: right;
52 display: inline-block;
53 }
54
55 .shang_logo {
56 display: block;
57 text-align: center;
58 margin: 20px auto;
59 }
60
61 .shang_tit {
62 width: 100%;
63 height: 75px;
64 text-align: center;
65 line-height: 66px;
66 color: #a3a3a3;
67 font-size: 16px;
68 background: url('../dashangimg/cy-reward-title-bg.jpg');
69 font-family: 'Microsoft YaHei';
70 margin-top: 7px;
71 margin-right: 2px;
72 }
73
74 .shang_tit p {
75 color: #a3a3a3;
76 text-align: center;
77 font-size: 16px;
78 }
79
80 .shang_payimg {
81 width: 150px;
82 height: 150px;
83 border: 6px solid #EA5F00;
84 margin: 0 auto;
85 border-radius: 3px;
86 }
87
88 .shang_payimg img {
89 display: block;
90 text-align: center;
91 width: 140px;
92 height: 140px;
93 }
94
95 .pay_explain {
96 text-align: center;
97 margin: 10px auto;
98 font-size: 12px;
99 color: #545454;
100 }
101
102 .radiobox {
103 width: 16px;
104 height: 16px;
105 background: url('../dashangimg/radio2.jpg');
106 display: block;
107 float: left;
108 margin-top: 5px;
109 margin-right: 14px;
110 }
111
112 .checked .radiobox {
113 background: url('../dashangimg/radio1.jpg');
114 }
115
116 .shang_payselect {
117 text-align: center;
118 margin: 0 auto;
119 margin-top: 40px;
120 cursor: pointer;
121 height: 60px;
122 width: 280px;
123 }
124
125 .shang_payselect .pay_item {
126 display: inline-block;
127 margin-right: 10px;
128 float: left;
129 }
130
131 .shang_info {
132 clear: both;
133 }
134
135 .shang_info p, .shang_info a {
136 color: #C3C3C3;
137 text-align: center;
138 font-size: 12px;
139 text-decoration: none;
140 line-height: 2em;
141 }打赏样式
相关推荐
- 移动硬盘跟固态硬盘的区别(移动硬盘跟固态硬盘的区别是什么)
-
一:移动硬盘移动硬盘是指以传统机械磁盘作为存储介质,用于计算机之间交换大容量数据,讲究移动便携性的存储产品。优点:具有容量大、价格便宜的特点,方便存储大量文件数据。(推荐学习:web前端视频教程)缺...
- windows怎么截图快捷键(windows截图快捷键没反应)
-
1、按Prtsc键截图这样获取的是整个电脑屏幕的内容,按Prtsc键后,可以直接打开画图工具,接粘贴使用。也可以粘贴在QQ聊天框或者Word文档中,之后再选择保存即可。2、按Ctrl+Prtsc键截图...
- 显示器分辨率有哪几种(显示器屏幕分辨率都有哪些)
-
目前使用较多的显示器分辨率有640*480,800*600,1024*768,1280*1024四种。刷新率,这主要是指显示器显示画面每秒刷新的次数,现在的电脑显示屏刷新率一般为75Hz,如果刷新率在...
- windows7激活工具 知乎(win7激活工具怎么使用教程)
-
Win7激活工具有很多,比如kms激活工具、小马激活工具、Windowsloader等。下面以这三款激活工具为例,做一个简单的比较。1、kms激活工具,相对比较稳定,通用性强,对各种gho、iso镜...
- 英伟达高端显卡排行(英伟达最高级显卡)
-
具体的排名如下:1、NVIDIAGeForceRTX30902、NVIDIAGeForceRTX3080Ti3、NVIDIAQuadroRTXA60004、NVIDIAGeFor...
- 苹果电脑为啥不能玩游戏(买苹果电脑的十大忠告)
-
1、MacBook本身就不是用来玩游戏的,是用来轻度办公的,只有集成显卡没有独立显卡,玩游戏也会非常卡。2、MacOS系统虽然支持steam软件,但是里面的游戏并不支持MacOS,况且本身支持MacO...
- 笔记本电脑显卡驱动怎么安装
-
使用驱动精灵或者驱动之家搜索驱动,下载后会自动安装驱动的。您好,以下是安装MacBook独立显卡驱动的步骤:1.打开“应用程序”,找到“实用工具”文件夹,打开“终端”。2.在终端窗口中输入以下命令...
- 家庭wifi已连接不可上网(家里wifi已连接不可用是什么原因)
-
WiFi已连接不可上网原因和解决方法一、路由器不稳定有些无线路由器、光猫(宽带猫)的质量比较差,长时间运行后会出现死机等一系列的问题。解决办法:把你家里的无线路由器、光猫(宽带猫)断电,等待几分钟,然...
- win10专业版在哪下(win10专业版在哪下载)
-
1.登陆MicroSoft官方网站会员中心,https://insider.windows.com/?lc=1033,点击“登陆”。2.使用hotmail邮箱或者开发者帐号登陆即可。3.选择“获...
- 中国杀毒软件十大排名(杀毒软件十大排名电脑有哪些)
-
第一名:火绒安全软件免费下载优点:口碑最好、安静、轻巧、界面简洁、无广告弹窗、无捆绑其他软件、占用内存少。缺点:我杀毒不行、不要紧张,我防毒也不行。第二名:腾讯电脑管家免费下载优点:我从良了...
- gpt分区安装win7ghost(gpt分区安装win7系统详细方法)
-
1、进入pe系统中,双击打开“分区工具”工具;2、右键选择硬盘(一般带有SSD字样),点击“快速分区”;3、分区表类型选择“GUID”即gpt,然后设置分区数目为自动,接着设置系统盘大小,建议5...
- pe windows是什么意思(pe windows是啥)
-
是一种轻量级操作系统,用于执行一组有限的任务,例如在脱机时对Windows操作系统进行故障排除、执行恢复选项以及安装完整的Windows操作系统。WindowsPE被创建为用于部署Mic...
- windows10如何关闭防火墙(windows10 如何关闭防火墙)
-
回答如下:以下是关闭Windows10防火墙的步骤:1.点击“开始”图标,然后选择“设置”(齿轮形图标)。2.在设置窗口中,选择“更新和安全”。3.在左侧菜单中,选择“Windows安全”。4...
- 戴尔笔记本按开机键没反应怎么办
-
可能存在的问题有:1、显示器连接问题。2、主板问题,芯片不稳定。3、检查内存问题。4、显示器故障。5、电池没电了。基于以上问题,建议你:1、显示器连接问题,检查显示器是否正确连接,以及是否开启开关。2...
- 一周热门
- 最近发表
- 标签列表
-
- python判断字典是否为空 (50)
- crontab每周一执行 (48)
- aes和des区别 (43)
- bash脚本和shell脚本的区别 (35)
- canvas库 (33)
- dataframe筛选满足条件的行 (35)
- gitlab日志 (33)
- lua xpcall (36)
- blob转json (33)
- python判断是否在列表中 (34)
- python html转pdf (36)
- 安装指定版本npm (37)
- idea搜索jar包内容 (33)
- css鼠标悬停出现隐藏的文字 (34)
- linux nacos启动命令 (33)
- gitlab 日志 (36)
- adb pull (37)
- python判断元素在不在列表里 (34)
- python 字典删除元素 (34)
- vscode切换git分支 (35)
- python bytes转16进制 (35)
- grep前后几行 (34)
- hashmap转list (35)
- c++ 字符串查找 (35)
- mysql刷新权限 (34)
