http://sir.co.kr/bbs/board.php?bo_table=tiptech&wr_id=3569
이 글을 보고 간단히 만들어봤습니다.
index.html
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Real-time Rank</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="application.js" type="text/javascript"></script>
</head>
<body>
<div id="content">
<dl id="rank-list">
<dt>실시간 급상승 검색어</dt>
<dd>
<ol>
<li><a href="#">1 순위</a></li>
<li><a href="#">2 순위</a></li>
<li><a href="#">3 순위</a></li>
<li><a href="#">4 순위</a></li>
<li><a href="#">5 순위</a></li>
<li><a href="#">6 순위</a></li>
<li><a href="#">7 순위</a></li>
<li><a href="#">8 순위</a></li>
<li><a href="#">9 순위</a></li>
<li><a href="#">10 순위</a></li>
</ol>
</dd>
</dl>
</div>
</body>
</html>
stylesheet.css
body {
font-size: 12px;
background: #FFF;
color: #333;
margin: 0;
}
#content {
margin: 20px;
padding: 10px;
background: #393;
}
#rank-list a {
color: #FFF;
text-decoration: none;
}
#rank-list a:hover {
text-decoration: underline;
}
#rank-list {
overflow: hidden;
width: 160px;
height: 20px;
margin: 0;
}
#rank-list dt {
display: none;
}
#rank-list dd {
position: relative;
margin: 0;
}
#rank-list ol {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
list-style-type: none;
}
#rank-list li {
height: 20px;
line-height: 20px;
}
application.js
$(function() {
var count = $('#rank-list li').length;
var height = $('#rank-list li').height();
function step(index) {
$('#rank-list ol').delay(2000).animate({
top: -height * index,
}, 500, function() {
step((index + 1) % count);
});
}
step(1);
});
이 글을 보고 간단히 만들어봤습니다.
index.html
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>Real-time Rank</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="stylesheet.css" media="screen" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
<script src="application.js" type="text/javascript"></script>
</head>
<body>
<div id="content">
<dl id="rank-list">
<dt>실시간 급상승 검색어</dt>
<dd>
<ol>
<li><a href="#">1 순위</a></li>
<li><a href="#">2 순위</a></li>
<li><a href="#">3 순위</a></li>
<li><a href="#">4 순위</a></li>
<li><a href="#">5 순위</a></li>
<li><a href="#">6 순위</a></li>
<li><a href="#">7 순위</a></li>
<li><a href="#">8 순위</a></li>
<li><a href="#">9 순위</a></li>
<li><a href="#">10 순위</a></li>
</ol>
</dd>
</dl>
</div>
</body>
</html>
stylesheet.css
body {
font-size: 12px;
background: #FFF;
color: #333;
margin: 0;
}
#content {
margin: 20px;
padding: 10px;
background: #393;
}
#rank-list a {
color: #FFF;
text-decoration: none;
}
#rank-list a:hover {
text-decoration: underline;
}
#rank-list {
overflow: hidden;
width: 160px;
height: 20px;
margin: 0;
}
#rank-list dt {
display: none;
}
#rank-list dd {
position: relative;
margin: 0;
}
#rank-list ol {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
list-style-type: none;
}
#rank-list li {
height: 20px;
line-height: 20px;
}
application.js
$(function() {
var count = $('#rank-list li').length;
var height = $('#rank-list li').height();
function step(index) {
$('#rank-list ol').delay(2000).animate({
top: -height * index,
}, 500, function() {
step((index + 1) % count);
});
}
step(1);
});
댓글 8개
14년 전
올리고 보니 쓸데없는 재귀가 쓰였군요. 바보 같은 코드인데...
window.setInterval로 처리하시는 게 훨씬 안전할 것 같습니다.
window.setInterval로 처리하시는 게 훨씬 안전할 것 같습니다.
14년 전
생각해 보면 animate가 interval을 쓰기 때문에 그냥 저 코드 그대로 가도 되는군요.
혼자 뭐하는 거지 (...)
혼자 뭐하는 거지 (...)
14년 전
혹 네이버,다음,네이트 실시간 검색어 XML 필요하시면
http://bangabmoa.com/api/hitkeyword.php?type=xml
활용하세요.
http://bangabmoa.com/api/hitkeyword.php?type=xml
활용하세요.
14년 전
upcount 말고 downcount가 있는지는 모르겠지만, 일단 upcount가 항상 있다는 가정 하에 적용해봤습니다.
[application.js]
$(function() {
function animateRankList() {
var count = $('#rank-list li').length;
var height = $('#rank-list li').height();
function step(index) {
$('#rank-list ol').delay(2000).animate({
top: -height * index,
}, 500, function() {
step((index + 1) % count);
});
}
step(1);
}
window.yqlCallback = function(data) {
$(data.query.results.channel.data.naver.item).each(function(index, item) {
var text = item.rank + ' - ' + item.keyword + ' [' + item.upcount + ']';
$('#rank-list li a').eq(index).text(text);
});
animateRankList();
}
$('#rank-list li a').text('');
var url = 'http://bangabmoa.com/api/hitkeyword.php?type=xml';
var yql = 'SELECT * FROM xml WHERE url="' + url + '"';
$.ajax({
url: 'http://query.yahooapis.com/v1/public/yql?q=' + yql +
'&format=json&callback=yqlCallback',
dataType: 'script'
});
});
[application.js]
$(function() {
function animateRankList() {
var count = $('#rank-list li').length;
var height = $('#rank-list li').height();
function step(index) {
$('#rank-list ol').delay(2000).animate({
top: -height * index,
}, 500, function() {
step((index + 1) % count);
});
}
step(1);
}
window.yqlCallback = function(data) {
$(data.query.results.channel.data.naver.item).each(function(index, item) {
var text = item.rank + ' - ' + item.keyword + ' [' + item.upcount + ']';
$('#rank-list li a').eq(index).text(text);
});
animateRankList();
}
$('#rank-list li a').text('');
var url = 'http://bangabmoa.com/api/hitkeyword.php?type=xml';
var yql = 'SELECT * FROM xml WHERE url="' + url + '"';
$.ajax({
url: 'http://query.yahooapis.com/v1/public/yql?q=' + yql +
'&format=json&callback=yqlCallback',
dataType: 'script'
});
});
14년 전
댓글에선 들여쓰기가 하나도 적용 안 되네요.
http://www.google.co.kr/search?q=JavaScript+Beautifier
맘에 드시는 JavaScript Beautifier를 골라 잡아서 돌려주시면 들여쓰기가 깔끔히 적용된 코드를 보실 수 있을 겁니다.
http://www.google.co.kr/search?q=JavaScript+Beautifier
맘에 드시는 JavaScript Beautifier를 골라 잡아서 돌려주시면 들여쓰기가 깔끔히 적용된 코드를 보실 수 있을 겁니다.
행복한남자
14년 전
http://jsbeautifier.org/
좋네요~ㅋ 감사합니다.
좋네요~ㅋ 감사합니다.
14년 전
이거 여러 부분에서 유용하겠네요
나스디자인
14년 전
오호~감사합니다
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 4030 | 14년 전 | 2112 | ||
| 4029 |
|
14년 전 | 710 | |
| 4028 | 14년 전 | 3620 | ||
| 4027 | 14년 전 | 3749 | ||
| 4026 |
techer
|
14년 전 | 1125 | |
| 4025 |
techer
|
14년 전 | 687 | |
| 4024 | 14년 전 | 1360 | ||
| 4023 | 14년 전 | 602 | ||
| 4022 | 14년 전 | 924 | ||
| 4021 | 14년 전 | 513 | ||
| 4020 | 14년 전 | 7339 | ||
| 4019 | 14년 전 | 1027 | ||
| 4018 | 14년 전 | 447 | ||
| 4017 | 14년 전 | 601 | ||
| 4016 | 14년 전 | 1303 | ||
| 4015 | 14년 전 | 734 | ||
| 4014 | 14년 전 | 567 | ||
| 4013 | 14년 전 | 688 | ||
| 4012 | 14년 전 | 617 | ||
| 4011 |
브라운벤취
|
14년 전 | 427 | |
| 4010 |
크라잉감튀
|
14년 전 | 594 | |
| 4009 | 14년 전 | 575 | ||
| 4008 | 14년 전 | 564 | ||
| 4007 | 14년 전 | 641 | ||
| 4006 |
네비플러스
|
14년 전 | 880 | |
| 4005 | 14년 전 | 897 | ||
| 4004 | 14년 전 | 1120 | ||
| 4003 | 14년 전 | 780 | ||
| 4002 |
핑크스파이더
|
14년 전 | 701 | |
| 4001 | 14년 전 | 578 | ||
| 4000 |
BYongLuv
|
14년 전 | 551 | |
| 3999 |
xxbobo
|
14년 전 | 533 | |
| 3998 | 14년 전 | 715 | ||
| 3997 | 14년 전 | 1932 | ||
| 3996 | 14년 전 | 583 | ||
| 3995 | 14년 전 | 909 | ||
| 3994 |
asdfdasfddd
|
14년 전 | 2080 | |
| 3993 | 14년 전 | 1182 | ||
| 3992 | 14년 전 | 954 | ||
| 3991 | 14년 전 | 4693 | ||
| 3990 |
Torrious
|
14년 전 | 1898 | |
| 3989 | 14년 전 | 768 | ||
| 3988 |
내꿈은대통령
|
14년 전 | 640 | |
| 3987 | 14년 전 | 617 | ||
| 3986 |
|
14년 전 | 480 | |
| 3985 | 14년 전 | 1739 | ||
| 3984 | 14년 전 | 3059 | ||
| 3983 | 14년 전 | 554 | ||
| 3982 | 14년 전 | 750 | ||
| 3981 | 14년 전 | 1733 | ||
| 3980 | 14년 전 | 602 | ||
| 3979 |
AMDbest
|
14년 전 | 1257 | |
| 3978 |
leadK
|
14년 전 | 1603 | |
| 3977 |
좋은천사7
|
14년 전 | 10384 | |
| 3976 |
좋은천사7
|
14년 전 | 1128 | |
| 3975 |
좋은천사7
|
14년 전 | 941 | |
| 3974 |
좋은천사7
|
14년 전 | 1659 | |
| 3973 |
좋은천사7
|
14년 전 | 1695 | |
| 3972 |
좋은천사7
|
14년 전 | 870 | |
| 3971 |
김준수사랑
|
14년 전 | 972 | |
| 3970 |
레인보우1492
|
14년 전 | 789 | |
| 3969 | 14년 전 | 2421 | ||
| 3968 | 14년 전 | 583 | ||
| 3967 | 14년 전 | 729 | ||
| 3966 | 14년 전 | 1785 | ||
| 3965 | 14년 전 | 2073 | ||
| 3964 |
방황하는중년
|
14년 전 | 515 | |
| 3963 |
네비플러스
|
14년 전 | 895 | |
| 3962 | 14년 전 | 679 | ||
| 3961 | 14년 전 | 733 | ||
| 3960 | 14년 전 | 929 | ||
| 3959 | 14년 전 | 742 | ||
| 3958 |
techer
|
14년 전 | 653 | |
| 3957 |
techer
|
14년 전 | 469 | |
| 3956 |
techer
|
14년 전 | 443 | |
| 3955 |
techer
|
14년 전 | 672 | |
| 3954 |
8제임스8
|
14년 전 | 824 | |
| 3953 |
구름1354
|
14년 전 | 646 | |
| 3952 |
8제임스8
|
14년 전 | 618 | |
| 3951 | 14년 전 | 2438 | ||
| 3950 | 14년 전 | 956 | ||
| 3949 | 14년 전 | 1104 | ||
| 3948 | 14년 전 | 1079 | ||
| 3947 | 14년 전 | 1511 | ||
| 3946 |
|
14년 전 | 1900 | |
| 3945 | 14년 전 | 597 | ||
| 3944 |
|
14년 전 | 779 | |
| 3943 | 14년 전 | 1814 | ||
| 3942 | 14년 전 | 802 | ||
| 3941 | 14년 전 | 2101 | ||
| 3940 |
내일은없다
|
14년 전 | 588 | |
| 3939 | 14년 전 | 786 | ||
| 3938 | 14년 전 | 895 | ||
| 3937 | 14년 전 | 2012 | ||
| 3936 | 14년 전 | 835 | ||
| 3935 | 14년 전 | 3199 | ||
| 3934 | 14년 전 | 968 | ||
| 3933 | 14년 전 | 500 | ||
| 3932 | 14년 전 | 828 | ||
| 3931 |
Jos87
|
14년 전 | 677 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기