广告投放

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

目录

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

    本操作需要下载附件引入相关js才能实现哦

    引入后到详情页面使用,如果需要在列表页面使用,可以适当修改相关参数

    注意文件引用路径,本教程使用的是根目录路径哦,如果是模板路径使用PB相应标签即可,有疑问欢迎艾特我哦

    html部分

    <div class="likes">
    
      <a href="{content:likeslink}" class="zan"><span class="zan-text">赞</span>(<span id="likes-num">{content:likes}</span>)</a>
    
    </div>
    
    <style>
    
    .likes {
    
      text-align: center;
    
    }
    
    .likes .zan {
    
      position: relative !important;
    
    }
    
    .likes a {
    
      height: 40px;
    
      line-height: 40px;
    
      display: inline-block;
    
      padding: 0 15px;
    
      background: #fff;
    
      border: 1px solid #4fc08d;
    
      color: #4fc08d;
    
      border-radius: 30px;
    
      transition: all .5s;
    
      -webkit-transition: all .5s;
    
    }
    
    .likes a.active, .likes a:hover {
    
        background: #4fc08d;
    
        color: #fff;
    
        transition: all .5s;
    
        -webkit-transition: all .5s;
    
    }
    
    .likes a span {
    
      text-align: center;
    
      margin: 0 3px;
    
    }
    
    .likes-tip {
    
      position: absolute;
    
      top: -45px;
    
      left: 50%;
    
      margin-left: -45px !important;
    
      margin-right: 0px !important;
    
      width: 90px;
    
      height: 30px;
    
      line-height: 30px;
    
      background: #4fc08d;
    
      border-radius: 3px;
    
      color: #fff;
    
      font-size: 14px;
    
      display: none;
    
    }
    
    .likes .zan:hover .likes-tip {
    
      display: block;
    
    }
    
    </style>

    js部分

    <script src="/libs/js/jQuery.cookie.js"></script>
    
    <script>
    
    var Like_status = jQuery.cookie('likes_{content:id}');
    
    if( Like_status == 1 ){
    
      $('.zan-text').empty().append('已赞');
    
      $('.zan').addClass('active');
    
      jQuery('.zan').append('<span class="tac likes-tip">您已点赞!</span>');
    
      jQuery('.like-link').removeAttr('href');
    
    }
    
    </script>

    相关附件

    PbootCMS点赞后再次进入显示已赞效果1584768528156424.zip


    声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

    给TA打赏
    共{{data.count}}人
    人已打赏
    广告位招租919838898
    0 条回复 A文章作者 M管理员
      暂无讨论,说说你的看法吧
    个人中心
    购物车
    优惠劵
    今日签到
    有新私信 私信列表
    搜索