找回密码
 立即注册
查看: 809|回复: 0

PB点赞后再次进入显示已赞效果

[复制链接]

UID
1
贡献
106
丢币
38688
主题
4562
回帖
113
注册时间
2018-9-25
最后登录
2023-3-22
发表于 2021-10-31 08:25 | 显示全部楼层 |阅读模式
PbootCMS点赞后再次进入显示已赞效果
本操作需要下载附件引入相关js才能实现哦
引入后到详情页面使用,如果需要在列表页面使用,可以适当修改相关参数
注意文件引用路径,本教程使用的是根目录路径哦,如果是模板路径使用PB相应标签即可,有疑问欢迎艾特我哦
html部分
  1. .likes a {
  2.   height: 40px;
  3.   line-height: 40px;
  4.   display: inline-block;
  5.   padding: 0 15px;
  6.   background: #fff;
  7.   border: 1px solid #4fc08d;
  8.   color: #4fc08d;
  9.   border-radius: 30px;
  10.   transition: all .5s;
  11.   -webkit-transition: all .5s;
  12. }

  13. .likes a.active, .likes a:hover {
  14.     background: #4fc08d;
  15.     color: #fff;
  16.     transition: all .5s;
  17.     -webkit-transition: all .5s;
  18. }

  19. .likes a span {
  20.   text-align: center;
  21.   margin: 0 3px;
  22. }

  23. .likes-tip {
  24.   position: absolute;
  25.   top: -45px;
  26.   left: 50%;
  27.   margin-left: -45px !important;
  28.   margin-right: 0px !important;
  29.   width: 90px;
  30.   height: 30px;
  31.   line-height: 30px;
  32.   background: #4fc08d;
  33.   border-radius: 3px;
  34.   color: #fff;
  35.   font-size: 14px;
  36.   display: none;
  37. }

  38. .likes .zan:hover .likes-tip {
  39.   display: block;
  40. }
  41. </style>
复制代码
js部分
  1. <script src="/libs/js/jQuery.cookie.js"></script>
  2. <script>
  3. var Like_status = jQuery.cookie('likes_{content:id}');
  4. if( Like_status == 1 ){
  5.   $('.zan-text').empty().append('已赞');
  6.   $('.zan').addClass('active');
  7.   jQuery('.zan').append('<span class="tac likes-tip">您已点赞!</span>');
  8.   jQuery('.like-link').removeAttr('href');
  9. }
  10. </script>
复制代码
PB相关附件下载如下:
文件名:jQuery.cookie.zip 
下载次数:0
大小:1.44 KB
售价:1 丢币 [记录] (提示:此售价仅购买本资源,不含其他任何服务)
免费下载用户组: 月VIP,年VIP,永久VIP,至尊永久VIP,其他用户组可金币购买。
增值服务:【升级VIP】 【金币充值】
安全检测,请放心下载

楼主热帖
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|网站地图|Archiver|自丢网 ( 粤ICP备17166275号 )

GMT+8, 2023-3-23 06:06

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表