pbootcms无刷新点赞
<a href="javascript:void(0);" class="zan fr"><span>赞</span>(<span id="likes-num">{content:likes}</span>)<span class="tac click-tip">您已点赞!</span></a> <style> .likes a:hover { background: #4fc08d; color: #fff; transition: all .5s; -webkit-transition: all .5s; } .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 span { text-align: center; margin: 0 3px; } .likes-tip, .click-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; text-align: center; display: none; } </style> <script src="{pboot:sitetplpath}/js/jQuery.cookie.js"></script> <script> var Like_status = jQuery.cookie('likes_{content:id}'); if( Like_status == 1 ){ $('.likes > .iconfont').attr('class', 'iconfont hover-color'); $('.zan').attr('title','您已点赞'); jQuery('.zan').append('<span class="tac likes-tip">您已点赞!</span>'); jQuery('.like-link').removeAttr('href'); $('.click-tip').css("display","none"); } </script> <script> $('.zan').on('click',//绑定点赞事件 function() { $.ajax({ url: '{content:likeslink}',//点赞链接 data: { 'likes': 'likes' }, success: function(data) { $('#likes-num').load(location.href + " #likes-num");//点赞后刷新#support_number if (data.state) {} else { $(".click-tip").css("display","block").delay(1500).fadeOut(400);//已赞提示 }}, error: function(xhr, status, error) { console.log(error) } }); }) </script>
如果您的问题还未解决可以联系站长付费协助。
有问题可以加入技术QQ群一起交流学习
本站vip会员 请加入无忧模板网 VIP群(50604020) PS:加入时备注用户名或昵称
普通注册会员或访客 请加入无忧模板网 技术交流群(50604130)
客服微信号:15898888535
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若内容侵犯了原著者的合法权益,可联系站长删除。