좋아요 버튼 질문좀 채택완료
zkdlf
8년 전
조회 2,402
추천 좋아요를 다른곳에 사용할려고 필요한것만 가지고 와서 이렇게 적용해봤는데 아무것도 작동이안되네요
현재 보여지는거 말고 좋아요 소스 다른게 필요한가요?
</p><p>.article_score {width:100%; padding:0px 10px;text-align:left; *zoom:1;}
.article_score a {display:inline-block; width:43px; height:43px; background:url('./img/sprites_btn.gif') no-repeat; *zoom:1; vertical-align:top;}
.article_score a.btn_good {background-position:0px 0;}
.article_score:after {content:""; display:block; clear:both;}
.article_score a {display:inline-block; width:33px; height:33px; background:url('./img/sprites_btn.gif') no-repeat; *zoom:1; vertical-align:top;margin: 20px 0px 0px 0px;}
.article_score a.btn_good {background-position:0px 0;}
.article_score a.btn_nogood {background-position:-308px 0;}
.article_score .graph {display:inline-block;*zoom:1; margin:0 3px; padding:5px 0; width:215px; height:23px; background:url('./img/sprites_btn.gif') no-repeat 0 -27px;}
.article_score .score_bar_wrap{display:block;float:left;width:144px;}
.article_score .graph .line_border {display:block;width:3px; height:10px; font-size:0; background:url('./img/sprites_ico.gif') no-repeat 0 -1162px;position:absolute;right:-3px;}
.article_score .graph .score_bar {display:block;float:none;height:10px; font-size:0; background:url('./img/bg_recom1.gif') repeat-x 0 3px;position:relative;}
.article_score em { width:34px; line-height:13px; font-family:tahoma; font-size:19px; font-style:normal; text-align:center; font-weight:bold;}
.article_score em.txt_good {color:#7191af;}
.article_score em.txt_nogood {color:#9f0010;}
.limit_score a {float:left;}
.limit_score em {float:left; padding: 0px 0px 0px 10px; width:auto; /*line-height:23px;*/ margin: 19px auto;}
.article_score .graph {display:inline-block;*zoom:1; margin:0 3px; padding:5px 0; width:265px; height:23px; background:url('./img/sprites_btn.gif') no-repeat 0 0;}
.article_score .score_bar_wrap{display:block;float:left;width:194px;}</p><p> </p><p> <?php /* 추천 비추천 모두 사용 */
if($is_good && $is_nogood) {
if(!$view[wr_good] && !$view[wr_nogood]) {
$abbab = "0.5";
} else {
$score_sum = $view[wr_nogood] + $view[wr_good];
$abbab = $view[wr_good] / $score_sum;
}
$size = round($abbab*100);
?>
<? } else if($is_good) { /* 추천만 사용 */ ?>
<div class="article_score limit_score">
<a class="btn_good" href="<?php echo $good_href ? $good_href.'&'.$qstr : '#no_member' ?>" id="good_button" title="추천" style="padding:15px 0px 0px 0px;">like</a>
<em id="txt_good" class="txt_good"><?=number_format($view[wr_good])?> goods</em>
<? } ?>
</div>
</li>
</ul>
</nav></p><p> </p><p> </p><p> </p><p><script type="text/javascript">
$("#good_button, #nogood_button").click(function() {
if($(this).attr('href')=="#no_member"){alert("회원만 참여 가능합니다.");return false;}
excute_good(this.href, this.id=="good_button" ? 1:0);
return false;
});</p><p> // 이미지 리사이즈
$("#bo_v_atc").viewimageresize();
});</p><p>function excute_good(href, $tx)
{
$.post(
href,
{ js: "on" },
function(data) {
if(data.error) {
alert(data.error);
return false;
}</p><p> if(data.count) {
if($tx)
{
$("#txt_good").text(number_format(String(data.count)));
var score_good=parseInt(data.count);
var score_nogood=parseInt($("#txt_nogood").text());
}
else
{
$("#txt_nogood").text(number_format(String(data.count)));
var score_good=parseInt($("#txt_good").text());
var score_nogood=parseInt(data.count);
}
var score_sum = score_good + score_nogood;
var rate = score_good / score_sum;
var size = Math.round(rate*100);
$("#score_bar").css('width', size+"%");
alert((!$tx ? "비" :"")+"추천이 반영되었습니다.");
}
}, "json"
);
}
</script> </p><p>
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
8년 전
좋아요 아이콘만 사용하는 것이라면
부트스트랩의 아이콘을 이용하시면 간단하게 사용하실 수 있으실 텐데요.
간단하게 예를 든다면,
</p><p><!DOCTYPE html>
<html>
<head>
<title>Bootstrap Icons</title>
<link rel="stylesheet" href="<a href="<a href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" target="_blank" rel="noopener noreferrer">https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css</a>"><a href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" target="_blank" rel="noopener noreferrer">https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css</a></a>">
</head>
<body class="container">
<i class="glyphicon glyphicon-thumbs-up" style="font-size:36px;color:#f00"></i>
</body>
</html></p><p>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 2개
z
zkdlf
8년 전
아이콘하고 아이콘을 누르면 작동도되게할려고요..^^;;
p
port
8년 전
아이콘을 눌렀을때 원하는 자바스크립트를 호출하려고 한다면
<i class="glyphicon glyphicon-thumbs-up" style="font-size:36px;color:#f00" onclick="호출할 함수"></i>
와 같은 형식으로 하시면 되겠지요.
<i class="glyphicon glyphicon-thumbs-up" style="font-size:36px;color:#f00" onclick="호출할 함수"></i>
와 같은 형식으로 하시면 되겠지요.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인