点赞、踩及收藏功能

		/*点赞点踩收藏*/
		.link_reward .link_box {
		    float: left;
		    margin-right: 20px;
		}	
		.link_reward .link_box a {
		    display: inline-block;
		}	
		.zan_statue{background:url(dianzan_huise.png) no-repeat left;background-position-y: 10px;background-size: 26%;}
		.yizan_curs i {background: url(dianzan_hongse.png) no-repeat;background-size: contain;}		
		.link_box_support .yizan_curs span, .link_box_support .yizan_curs em {color: #f04748;}		
		.oppse_icon1{
			background: url(cai_huise.png) no-repeat;
	        background-size: contain;			
		}
		.oppse_icon{
			background: url(cai_hongse.png) no-repeat;
	        background-size: contain;
		}	
		.manage_sc{
		    background: url(shoucang_huise.png) no-repeat;
		        background-size: contain;
		}
		.manage_qxsc{
		    background: url(shoucang_hongsese.png) no-repeat;
		        background-size: contain;
		}	
<div class="link_reward clearfix">
      <div class="link_box link_box_support"><a href="javascript:pub_support(252898);" class="clearfix zan_statue"><i></i><span style="margin-right:5px;">&nbsp;赞</span><span>(<em class="sup_number">27</em>)</span></a></div>
      <div class="link_box link_box_oppose"><li class="tools_oppose"><a href="javascript:;" class="manage_oppose" id="expressoppose_252898"><i class="oppse_icon"></i><span id="e_support_252898" style="color: rgb(240, 71, 72);">踩3</span></a></li></div>
      <div class="link_box link_box_collent"><li class="manage_list" id="adminiexp_252898"><a href="javascript:void(0);" class="admini_collect" data-okind="express" data-oid="252898" data-act=""><i class="manage_sc"></i><span>收藏</span></a></li></div>
</div>

 

		//点踩
		$('.manage_oppose').on('click',function(e){
			var _id = $(this).attr('id').split('_');
			if($('.link_box_support a').hasClass('yizan_curs')){
				pl_pop('已赞过了!');
				return;
			}else{
				$('.link_reward .tools_oppose i').removeClass('oppse_icon1');
				$('.link_reward .tools_oppose i').addClass('oppse_icon');
				$('#e_support_'+_id[1]).css('color','#f04748');
//				$('#e_support_'+_id[1]).html('踩'+parseInt(cont.oppose_num)+1);
				$('#e_support_'+_id[1]).html('踩'+(parseInt(cont.oppose_num)+1));
		        $.post(
		            "xxxxxxxxxxxxxxxxxxxx",
		            {kind:'express', id:_id, type:"oppose"},
		            function(data){
		            	localStorage.setItem("oppose_status_express_"+_id,"yes");
		            }
		        );
			}
		});
    //点赞
    function pub_support(_id){
        if($('.link_box_oppose i').hasClass('oppse_icon')){
			pl_pop('已踩过了!');
			return;        	
        }else{
	        if(storage.getItem("praised_status_live_msg_"+_id)=="yes"){
	            return;
	        }
	        if (support_list.indexOf(_id) >= 0){
	            return;
	        }
	        support_list.push(_id);
	    	var support_num = parseInt(jQuery(".sup_number").html());
	        jQuery(".sup_number").html(support_num+1);
	        jQuery(".sup_number").parents('a').addClass("yizan_curs");
	        jQuery(".sup_number").parents('a').removeClass("zan_statue");
	        jQuery.post(
	            "xxxxxxxxxxxxxxxxxxxxxxxxx",
	            {kind:"express", id:_id, type:"support"},
	            function(data){
	                localStorage.setItem("praised_status_live_msg_"+_id,"yes");
	            }
	        ); 
        }
    }
       	//收藏
       	$('.manage_list').on('click',function(e){
       		var _id = $(this).attr('id').split('_');
       		if($('.admini_collect span').html()=='收藏'){
       			$('.mp_det_inner').html('收藏成功!')
     			$('.managePopdet').show().delay (500).fadeOut();
       			$('.admini_collect span').html('已收藏');
       			$('.link_reward .manage_list i').removeClass('manage_sc');
       			$('.link_reward .manage_list i').addClass('manage_qxsc');       			
       		}else{
//     			$('.mp_det_inner').html('您已取消收藏!')
//   			$('.managePopdet').show().delay (3000).fadeOut();
				$('.managePopup').show();
				$('.mP_psg').hide();
				$('.manageBg').show();
				$('.mP_confirm').on('click',function(){
	       			$('.admini_collect span').html('收藏');
	       			$('.managePopup').hide();
					$('.manageBg').hide();
	       			$('.link_reward .manage_list i').removeClass('manage_qxsc');
	       			$('.link_reward .manage_list i').addClass('manage_sc');	
				})
       			
       		}
	        $.post(
	            "xxxxxxxxxxxxxxxxxxxxxxx",
	            {kind:'express',md:_Libs.md, o_id:_id},
	            function(data){
	            	localStorage.setItem("oppose_status_express_"+_id,"yes");
	            }
	        );       		
       	});

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值