반응형


네이버 메모 앱 하단으로 스크롤 할때 마다 

하나씩 글을 불러오는 기능이 좋아보임..

키워드를 모르겠다.. 

안드로이드에서만 되는건지 웹에서도 가능한건지..



스크롤 하단에서 100px 정도 이동하면 아래에 append 로 붙이면 될꺼 같은데 소스 찾기가 쉽지 않음 ㅠㅠ



http://greensock.com/examples-showcases ( 시간차를 두면서 이용하는 스크립트)


http://jsfiddle.net/inspired_jw/KCC8V/1/ (하단에 왔을때 체크하는 소스)

반응형
반응형

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Flick Navigation</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=medium-dpi" />


<style type="text/css">


/* Basic Style START (dohoons, 200803, 200908, 201011, 201106) */

html, body { height:100%; -webkit-text-size-adjust:none; }

body, input, select, button, textarea, h1, h2, h3, h4, h5, h6, table { font:normal 12px/1.5 dotum,"돋움",Arial,AppleGothic,Sans-serif; color:#666; }

html, body, div, form, input, select, button, textarea, legend, fieldset, h1, h2, h3, h4, h5, h6, ul, ol, dl, li, dt, dd, blockquote, address, p, th, td, caption { margin:0; padding:0; }

ol, ul, li { list-style:none; }

img, fieldset { border:0 none; }

input, select, textarea { vertical-align:middle; resize:none; position:relative; }

input, textarea { -webkit-appearance:none; -webkit-border-radius:0; }

input[type="checkbox"] { -webkit-appearance:checkbox; }

input[type="radio"] { -webkit-appearance:radio; -webkit-border-radius:10px; }

button { border:0 none; background:transparent; cursor:pointer; }

hr { display:none; }

legend, .hide { width:0; height:0; visibility:hidden; font-size:0; line-height:0; position:absolute; top:0; left:0; overflow:hidden; }

table caption { width:0; height:0; visibility:hidden; text-indent:-9999px; font-size:0; line-height:0; }

table { border-collapse:collapse; border-spacing:0; }

header, footer, section, article, aside, nav, hgroup, details, menu, figure, figcaption { display:block; }


a:link, a:visited { text-decoration:none; color:#666; }

a:active, a:hover, a:focus { text-decoration:underline; }


input.basic { height:19px; line-height:19px; padding:0 5px; border:1px solid #cacaca; *margin-top:-1px; _margin-top:-2px; }

textarea.basic { border:1px solid #cacaca; padding:5px; overflow:scroll; overflow-x:hidden; *margin-top:-1px; _margin-top:-2px; }

select.basic { height:21px; }

/* Basic Style END */


#touchSlider6 { width:100%; height:150px; margin:0 auto; background:#ccc; position:relative; overflow:hidden; }

#touchSlider6 ul { width:99999px; height:150px; position:absolute; top:0; left:0; overflow:hidden; }

#touchSlider6 ul li { float:left; width:100%; height:150px; background:#9C9; font-size:14px; color:#fff; }



.btn_area { background:#f5f5f5; overflow:hidden; }

.btn_area button { display:block; width:100px; height:36px; background:#000; font-size:16px; color:#fff; font-weight:bold; }

.btn_area button.btn_prev { float:left; }

.btn_area button.btn_next { float:right; }

.btn_area .btn_page { display:inline-block; width:10px; height:10px; margin:3px; font-size:0px; line-height:0; text-indent:-9999px; background:#3399CC; }

.btn_area .btn_page.on { background:#ff0000; }



</style>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>

<script type="text/javascript" src="../js/jquery.event.drag-1.5.min.js"></script>

<script type="text/javascript" src="../js/jquery.touchSlider.js"></script>

<script type="text/javascript">


  $(document).ready(function() {



$("#touchSlider6").touchSlider({


flexible : true,

initComplete : function (e) {

$("#touchSlider6_paging").html("");

var num = 1;

$("#touchSlider6 ul li").each(function (i, el) {

if((i+1) % e._view == 0) {

$("#touchSlider6_paging").append('<button type="button" class="btn_page">page' + (num++) + '</button>');

}

});

$("#touchSlider6_paging .btn_page").bind("click", function (e) {

var i = $(this).index();

$("#touchSlider6").get(0).go_page(i);

});

},

counter : function (e) {

$("#touchSlider6_paging .btn_page").removeClass("on").eq(e.current-1).addClass("on");

}

});


});

</script>


 </head>


 <body>


  <h2>6 : flexible, rolling, paging, counter</h2>

<div id="touchSlider6">

<ul>

<li>

content 1

</li>

<li style="background:#396">

content 2

</li>

<li style="background:#39C">

content 3

</li>

<li style="background:#33C">

content 4

</li>

</ul>

</div>


<div id="touchSlider6_paging" class="btn_area" style="text-align:center;"></div>



 </body>

</html>



jquery.event.drag-1.5.min.js


/* 

jquery.event.drag.js ~ v1.5 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)  

Liscensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt

*/

(function(E){E.fn.drag=function(L,K,J){if(K){this.bind("dragstart",L)}if(J){this.bind("dragend",J)}return !L?this.trigger("drag"):this.bind("drag",K?K:L)};var A=E.event,B=A.special,F=B.drag={not:":input",distance:0,which:1,dragging:false,setup:function(J){J=E.extend({distance:F.distance,which:F.which,not:F.not},J||{});J.distance=I(J.distance);A.add(this,"mousedown",H,J);if(this.attachEvent){this.attachEvent("ondragstart",D)}},teardown:function(){A.remove(this,"mousedown",H);if(this===F.dragging){F.dragging=F.proxy=false}G(this,true);if(this.detachEvent){this.detachEvent("ondragstart",D)}}};B.dragstart=B.dragend={setup:function(){},teardown:function(){}};function H(L){var K=this,J,M=L.data||{};if(M.elem){K=L.dragTarget=M.elem;L.dragProxy=F.proxy||K;L.cursorOffsetX=M.pageX-M.left;L.cursorOffsetY=M.pageY-M.top;L.offsetX=L.pageX-L.cursorOffsetX;L.offsetY=L.pageY-L.cursorOffsetY}else{if(F.dragging||(M.which>0&&L.which!=M.which)||E(L.target).is(M.not)){return }}switch(L.type){case"mousedown":E.extend(M,E(K).offset(),{elem:K,target:L.target,pageX:L.pageX,pageY:L.pageY});A.add(document,"mousemove mouseup",H,M);G(K,false);F.dragging=null;return false;case !F.dragging&&"mousemove":if(I(L.pageX-M.pageX)+I(L.pageY-M.pageY)<M.distance){break}L.target=M.target;J=C(L,"dragstart",K);if(J!==false){F.dragging=K;F.proxy=L.dragProxy=E(J||K)[0]}case"mousemove":if(F.dragging){J=C(L,"drag",K);if(B.drop){B.drop.allowed=(J!==false);B.drop.handler(L)}if(J!==false){break}L.type="mouseup"}case"mouseup":A.remove(document,"mousemove mouseup",H);if(F.dragging){if(B.drop){B.drop.handler(L)}C(L,"dragend",K)}G(K,true);F.dragging=F.proxy=M.elem=false;break}return true}function C(M,K,L){M.type=K;var J=E.event.handle.call(L,M);return J===false?false:J||M.result}function I(J){return Math.pow(J,2)}function D(){return(F.dragging===false)}function G(K,J){if(!K){return }K.unselectable=J?"off":"on";K.onselectstart=function(){return J};if(K.style){K.style.MozUserSelect=J?"":"none"}}})(jQuery);



jquery.touchSlider.js


/**

 * @name jQuery.touchSlider

 * @author dohoons ( http://dohoons.com/ )

 *

 * @version 201504

 * @since 201106

 *

 * @param Object settings 환경변수 오브젝트

 * roll - 순환 (default true)

 * flexible - 유동 레이아웃 (default false)

 * view - 다중 컬럼 (default 1)

 * speed - 애니메이션 속도 (default 75)

 * range - 넘김 판정 범위 (default 0.15)

 * page - 초기 페이지 (default 1)

 * transition - CSS3 transition 사용 (default true)

 * btn_prev - prev 버튼 (jQuery Object, default null)

 * btn_next - next 버튼 (jQuery Object, default null)

 * paging - page 버튼 (jQuery Object, default null)

 * initComplete - 초기화 콜백

 * counter - 슬라이드 콜백, 카운터

 *

 * @example

 

$("#target").touchSlider({

flexible : true

});


*/


(function ($) {

$.fn.touchSlider = function (settings) {

settings.supportsCssTransitions = (function (style) {

var prefixes = ['Webkit','Moz','Ms'];

for(var i=0, l=prefixes.length; i < l; i++ ) {

if( typeof style[prefixes[i] + 'Transition'] !== 'undefined') {

return true;

}

}

return false;

})(document.createElement('div').style);

settings = jQuery.extend({

roll : true,

flexible : false,

btn_prev : null,

btn_next : null,

paging : null,

speed : 75,

view : 1,

range : 0.15,

page : 1,

transition : true,

initComplete : null,

counter : null

}, settings);

var opts = [];

opts = $.extend({}, $.fn.touchSlider.defaults, settings);

return this.each(function () {

var _this = this;

$.fn.extend(this, touchSlider);

this.opts = opts;

this.init();

$(window).bind("orientationchange resize", function () {

_this.resize(_this);

});

});

};

var touchSlider = {

init : function () {

var _this = this;

this._view = this.opts.view;

this._speed = this.opts.speed;

this._tg = $(this);

this._list = this._tg.children().children();

this._width = parseInt(this._tg.css("width"));

this._item_w = parseInt(this._list.css("width"));

this._len = this._list.length;

this._range = this.opts.range * this._width;

this._pos = [];

this._start = [];

this._startX = 0;

this._startY = 0;

this._left = 0;

this._top = 0;

this._drag = false;

this._scroll = false;

this._btn_prev;

this._btn_next;

$(this)

.unbind("touchstart", this.touchstart)

.unbind("touchmove", this.touchmove)

.unbind("touchend", this.touchend)

.unbind("dragstart", this.touchstart)

.unbind("drag", this.touchmove)

.unbind("dragend", this.touchend)

.bind("touchstart", this.touchstart)

.bind("touchmove", this.touchmove)

.bind("touchend", this.touchend)

.bind("dragstart", this.touchstart)

.bind("drag", this.touchmove)

.bind("dragend", this.touchend)

$(this).children().css({

"width":this._width + "px",

"overflow":"visible"

});

if(this.opts.flexible) this._item_w = this._width / this._view;

if(this.opts.roll) {

if(this._len % this._view > 0) {

var blank = $(document.createElement(this._list.eq(0).eq(0).prop("tagName"))).hide();

var cnt = this._view - (this._len % this._view);

for(var i=0; i<cnt; ++i) {

this._list.parent().append(blank.clone());

}

}

this._list = this._tg.children().children();

this._len = this._list.length;

this._len = (this._len / this._view) * this._view;

}

var page_gap = (this.opts.page > 1 && this.opts.page <= this._len) ? (this.opts.page - 1) * this._item_w : 0;

for(var i=0; i<this._len; ++i) {

this._pos[i] = this._item_w * i - page_gap;

this._start[i] = this._pos[i];

this._list.eq(i).css({

"float" : "none",

"position" : "absolute",

"top" : "0",

"left" : this._pos[i] + "px",

"width" : this._item_w + "px"

});

if(this.opts.supportsCssTransitions && this.opts.transition) {

this._list.eq(i).css({

"-moz-transition" : "0ms",

"-moz-transform" : "",

"-ms-transition" : "0ms",

"-ms-transform" : "",

"-webkit-transition" : "0ms",

"-webkit-transform" : "",

"transition" : "0ms",

"transform" : ""

});

}

}

if(this.opts.btn_prev && this.opts.btn_next) {

this.opts.btn_prev.unbind("click").bind("click", function() {

_this.animate(1, true);

return false;

})

this.opts.btn_next.unbind("click").bind("click", function() {

_this.animate(-1, true);

return false;

});

}

if(this.opts.paging) {

$(this._list).each(function (i, el) {

var btn_page = _this.opts.paging.eq(0).clone();

_this.opts.paging.before(btn_page);

btn_page.bind("click", function(e) {

_this.go_page(i, e);

return false;

});

});

this.opts.paging.remove();

}

this.initComplete();

this.counter();

},

initComplete : function () {

if(typeof(this.opts.initComplete) == "function") {

this.opts.initComplete(this);

}

},

resize : function (e) {

if(e.opts.flexible) {

var tmp_w = e._item_w;

e._width = parseInt(e._tg.css("width"));

e._item_w = e._width / e._view;

e._range = e.opts.range * e._width;

for(var i=0; i<e._len; ++i) {

e._pos[i] = e._pos[i] / tmp_w * e._item_w;

e._start[i] = e._start[i] / tmp_w * e._item_w;

e._list.eq(i).css({

"left" : e._pos[i] + "px",

"width" : e._item_w + "px"

});

if(this.opts.supportsCssTransitions && this.opts.transition) {

e._list.eq(i).css({

"-moz-transition" : "0ms",

"-moz-transform" : "",

"-ms-transition" : "0ms",

"-ms-transform" : "",

"-webkit-transition" : "0ms",

"-webkit-transform" : "",

"transition" : "0ms",

"transform" : ""

});

}

}

}

this.counter();

},

touchstart : function (e) {

if((e.type == "touchstart" && e.originalEvent.touches.length <= 1) || e.type == "dragstart") {

this._startX = e.pageX || e.originalEvent.touches[0].pageX;

this._startY = e.pageY || e.originalEvent.touches[0].pageY;

this._scroll = false;

this._start = [];

for(var i=0; i<this._len; ++i) {

this._start[i] = this._pos[i];

}

}

},

touchmove : function (e) {

if((e.type == "touchmove" && e.originalEvent.touches.length <= 1) || e.type == "drag") {

this._left = (e.pageX || e.originalEvent.touches[0].pageX) - this._startX;

this._top = (e.pageY || e.originalEvent.touches[0].pageY) - this._startY;

var w = this._left < 0 ? this._left * -1 : this._left;

var h = this._top < 0 ? this._top * -1 : this._top;

if (w < h || this._scroll) {

this._left = 0;

this._drag = false;

this._scroll = true;

} else {

if ( navigator.userAgent.indexOf("android 4.1") > -1 ) {

e.stopPropagation();

} else {

e.preventDefault();

}

this._drag = true;

this._scroll = false;

this.position(e);

}

for(var i=0; i<this._len; ++i) {

var tmp = this._start[i] + this._left;

if(this.opts.supportsCssTransitions && this.opts.transition) {

var trans = "translate3d(" + tmp + "px,0,0)";

this._list.eq(i).css({

"left" : "",

"-moz-transition" : "0ms",

"-moz-transform" : trans,

"-ms-transition" : "0ms",

"-ms-transform" : trans,

"-webkit-transition" : "0ms",

"-webkit-transform" : trans,

"transition" : "0ms",

"transform" : trans

});

} else {

this._list.eq(i).css("left", tmp + "px");

}

this._pos[i] = tmp;

}

}

},

touchend : function (e) {

if((e.type == "touchend" && e.originalEvent.touches.length <= 1) || e.type == "dragend") {

if(this._scroll) {

this._drag = false;

this._scroll = false;

return false;

}

this.animate(this.direction());

this._drag = false;

this._scroll = true;

}

},

position : function (d) { 

var gap = this._view * this._item_w;

if(d == -1 || d == 1) {

this._startX = 0;

this._start = [];

for(var i=0; i<this._len; ++i) {

this._start[i] = this._pos[i];

}

this._left = d * gap;

} else {

if(this._left > gap) this._left = gap;

if(this._left < - gap) this._left = - gap;

}

if(this.opts.roll) {

var tmp_pos = [];

for(var i=0; i<this._len; ++i) {

tmp_pos[i] = this._pos[i];

}

tmp_pos.sort(function(a,b){return a-b;});

var max_chk = tmp_pos[this._len-this._view];

var p_min = $.inArray(tmp_pos[0], this._pos);

var p_max = $.inArray(max_chk, this._pos);

if(this._view <= 1) max_chk = this._len - 1;

if((d == 1 && tmp_pos[0] >= 0) || (this._drag && tmp_pos[0] > 0)) {

for(var i=0; i<this._view; ++i, ++p_min, ++p_max) {

this._start[p_max] = this._start[p_min] - gap;

this._list.eq(p_max).css("left", this._start[p_max] + "px");

}

} else if((d == -1 && tmp_pos[max_chk] <= 0) || (this._drag && tmp_pos[max_chk] <= 0)) {

for(var i=0; i<this._view; ++i, ++p_min, ++p_max) {

this._start[p_min] = this._start[p_max] + gap;

this._list.eq(p_min).css("left", this._start[p_min] + "px");

}

}

} else {

if(this.limit_chk()) this._left = this._left / 2;

}

},

animate : function (d, btn_click) {

if(this._drag || !this._scroll || btn_click) {

var _this = this;

var speed = this._speed;

if(btn_click) this.position(d);

var gap = d * (this._item_w * this._view);

if(this._left == 0 || (!this.opts.roll && this.limit_chk()) ) gap = 0;

this._list.each(function (i, el) {

_this._pos[i] = _this._start[i] + gap;

if(_this.opts.supportsCssTransitions && _this.opts.transition) {

var transition = speed + "ms";

var transform = "translate3d(" + _this._pos[i] + "px,0,0)";

if(btn_click) transition = "0ms";

$(this).css({

"left" : "",

"-moz-transition" : transition,

"-moz-transform" : transform,

"-ms-transition" : transition,

"-ms-transform" : transform,

"-webkit-transition" : transition,

"-webkit-transform" : transform,

"transition" : transition,

"transform" : transform

});

} else {

$(this).animate({"left": _this._pos[i] + "px"}, speed);

}

});

this.counter();

}

},

direction : function () { 

var r = 0;

if(this._left < -(this._range)) r = -1;

else if(this._left > this._range) r = 1;

if(!this._drag || this._scroll) r = 0;

return r;

},

limit_chk : function () {

var last_p = parseInt((this._len - 1) / this._view) * this._view;

return ( (this._start[0] == 0 && this._left > 0) || (this._start[last_p] == 0 && this._left < 0) );

},

go_page : function (i, e) {

var crt = ($.inArray(0, this._pos) / this._view) + 1;

var cal = crt - (i + 1);

while(cal != 0) {

if(cal < 0) {

this.animate(-1, true);

cal++;

} else if(cal > 0) {

this.animate(1, true);

cal--;

}

}

},

get_page : function () {

return {

total : Math.ceil(this._len / this._view),

current : ($.inArray(0, this._pos) / this._view) + 1

}

},

counter : function () {

if($.inArray(0, this._pos) < 0) {

this.init();

}

this.opts.page = this.get_page().current;

if(typeof(this.opts.counter) == "function") {

this.opts.counter(this.get_page());

}

}

};


})(jQuery);



출처 http://dohoons.com/test/flick/



반응형
반응형




<!DOCTYPE html>

<html xml:lang="ko" lang="ko">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />

<meta name="apple-mobile-web-app-capable" content="yes" />

<title>KOMVO</title>


<link rel="stylesheet" type="text/css" href="../css/base.css"/>    

<link rel="stylesheet" type="text/css" href="../css/common.css"/>


<script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>

<script type="text/javascript" src="../js/komvo-ui.js"></script>


<!-- Link Swiper's CSS -->

<link rel="stylesheet" href="../css/swiper.css">


<!-- Demo styles -->

<style>

.swiper-container {

width: 100%;

height: 100%;

}

.swiper-container-horizontal>.swiper-pagination { position:relative; top:0; right:0%; height:24px; border-bottom:1px solid #e2e3e4; overflow:hidden; }

.swiper-container-horizontal>.swiper-pagination .swiper-pagination-bullet {margin:0 24px;}

.swiper-pagination-clickable .swiper-pagination-bullet { background:#ff0000; height:24px; margin:0 24px; }

.swiper-container-horizontal>.swiper-pagination .swiper-pagination-bullet { height:12px; margin-top:8px; background:url(../images/mnu_sub.png) no-repeat; background-size:500px auto; border-radius:0; }

.swiper-container-horizontal>.swiper-pagination .swiper-pagination-bullet:nth-child(1) {width:64px; background-position:0 0;}

.swiper-container-horizontal>.swiper-pagination .swiper-pagination-bullet:nth-child(2) {width:49px; background-position:-111px 0;}

.swiper-container-horizontal>.swiper-pagination .swiper-pagination-bullet:nth-child(3) {width:98px; background-position:-208px 0;}

.swiper-container-horizontal>.swiper-pagination .swiper-pagination-bullet:nth-child(4) {width:60px; background-position:-354px 0;}


.swiper-pagination-bullet-active {opacity:100%;}

.swiper-container-horizontal>.swiper-pagination .swiper-pagination-bullet:nth-child(1).swiper-pagination-bullet-active {background-position:0 -15px;}

.swiper-container-horizontal>.swiper-pagination .swiper-pagination-bullet:nth-child(2).swiper-pagination-bullet-active {background-position:-111px -15px;}

.swiper-container-horizontal>.swiper-pagination .swiper-pagination-bullet:nth-child(3).swiper-pagination-bullet-active {background-position:-208px -15px;}

.swiper-container-horizontal>.swiper-pagination .swiper-pagination-bullet:nth-child(4).swiper-pagination-bullet-active {background-position:-354px -15px;}



.swiper-wrapper {height:100%; min-height:480px; }

.swiper-slide {

background: #fff;

/* Center slide text vertically */

display: -webkit-box;

display: -ms-flexbox;

display: -webkit-flex;

display: flex;

-webkit-box-pack: center;

-ms-flex-pack: center;

-webkit-justify-content: center;

justify-content: center;

-webkit-box-align: center;

-ms-flex-align: center;

-webkit-align-items: center;

align-items: center;

}


.subContent .cds_h2 { height:50px; overflow:hidden; }

.subContent .sector {background:url(../images/mnu_sub.png); background-size:500px 28px; }

.subContent .sector.smnu01 {background-position:0 0;}

.subContent .sector.smnu02 {background-position:112px 0;}

.subContent .sector.smnu03 {background-position:208px 0;}


.loadingOn {

background : url(../images/komvo_Loding1.gif) 0 0 no-repeat;

-webkit-background-size : 28px 12px;

background-size : 28px 12px;

}

.loadingOff {

background : url(../images/komvo_Loding2.gif) 0 0 no-repeat;

-webkit-background-size : 28px 12px;

background-size : 28px 12px;

}

.hr_ld {margin:20px 0; overflow:hidden;}

.loadingOn,

.loadingOff {text-align:center;display:block; height:12px; background-position:50% 50%; }


.loadingOn em,

.loadingOff em {border:0; position:absolute; top:-10000px; left:-10000px; height:1px;font-size:1px; line-height:1px;}

</style>

<script>


var result_json="";

var renult_nextPage="";

var result_nextValue="";

var isComplete = false;

var lank =0;


$(document).ready(function(){

fn_load("0");  

});


fn_load = function(type){

// 마지막 데이타 체크

if ( type != "0" && renult_nextPage == undefined ){


alert('더이상 데이타가 없습니다.'); 

return;

}


$.ajax({

url: "https://www.googleapis.com/youtube/v3/playlistItems?"

+ [

"part=snippet",

"playlistId=PLSJkNdQGrU_z6TaXcxywg11bUKe6JFL71",

"order=date",

"maxResults=10",

"pageToken="+renult_nextPage,

"key=AIzaSyApAIIzHW07iHsS1z_ON4fLC_IAHy4sp64"

].join("&"),

dataType: "jsonp",

success: function(data){


result_json = data.items;

renult_nextPage = data.nextPageToken;


if(result_json.length >0)

{



for(i=0;i<result_json.length;i++){

//alert(result_json[i].id.videoId);

//alert(result_json[i].snippet.channelTitle);

lank = lank + 1;


var result_Value="<div class='wrp_cds'><div class='cds'>"; 

result_Value= result_Value + "<div class='cds_addition'>";

result_Value= result_Value + "<object type='text/html' data='http://www.youtube.com/embed/" + result_json[i].snippet.resourceId.videoId +"' allowFullScreen></object>";

result_Value= result_Value + "</div>";

result_Value= result_Value + "</div></div>";

$("#now").append(result_Value);


/*

var result_Value="<div class='wrp_cds'><div class='cds'>"; 

result_Value= result_Value + "<div class='cds_addition'><img data-src='"+result_json[i].snippet.thumbnails.high.url+"' width='100%' alt='' src='"+result_json[i].snippet.thumbnails.high.url+"'>"+lank+"</div>";

result_Value= result_Value + "<div class='cds_explain'><h2 class='cds_h2'><a href='play_jw.html?v=" + result_json[i].id.videoId + "&title=" + escape(result_json[i].snippet.title) + "'  >" + result_json[i].snippet.title +"</a></h2></div>";

result_Value= result_Value + "<div class='cds_bundle'><a href='play_jw.html?v=" + result_json[i].id.videoId + "&title=" + escape(result_json[i].snippet.title) + "' class='cds_send _MM_SHARE'  ><span class='imh im_send'>33,636,054 views</span></a></div><a href='#' class='cds_a' ><div><span class='blind'>"+result_json[i].snippet.publishedAt +"</span></div></a>";

result_Value= result_Value + "</div></div>";

*/

//console.log(result_Value);

//alert(result_Value);


//$("#now").append(result_Value);


}

}

}

});

}

// 하단 스크롤 데이타 append

$(document).ready(function (event){


$(window).scroll(function(){


var scrollHeight = $(window).scrollTop() + $(window).height();


var documentHeight = $(document).height();


//스크롤이 맨아래로 갔는지 아닌지 확인하는 if문


if(scrollHeight == documentHeight){

fn_load("2")

}


});


});


</script>

<!-- Swiper JS -->

<script src="../js/swiper.min.js"></script>


<!-- Initialize Swiper -->

<script>

var swiper = new Swiper('.swiper-container', {

pagination: '.swiper-pagination',

paginationClickable: true,

spaceBetween: 30,

});

</script>

</head>

<body>



<nav class="snb">

<div class="container">

<ul class="menuList">

<li><a href="#none">Home</a></li>

<li><a href="#none">TV Program</a></li>

<li><a href="#none" class="on">Entertainment</a></li>

<li><a href="#none">Fan’s Video</a></li>

<li><a href="#none">Favorite</a></li>

</ul>

<div class="userCtrlWrap">

<div class="setting">

<a href="#">Settings</a>

</div>

</div>

</div>

</nav>

<div id="wrap">

<header>

<div class="top">

<a href="#" class="btnMenu jsNavSnb">목록</a>

<!-- SubPage -->

<h1><a href="#"><span class="tit">TV Program</span></a></h1>

<a href="#" class="orderP">Popular</a>

<!-- 

<a href="#" class="orderP on">Popular</a>

<a href="#" class="orderL">Latest</a>

<a href="#" class="orderL on">Latest</a>

-->


<!-- MainPage Only  -->

<!-- <h1><a href="#"><span class="logo">KOMVO  logo</span></a></h1> -->


<a href="#" onclick="javascript:openLayerPop1(0);return false;" class="btnSearch">Search</a>


<div class="laypopup inPop search">

<!-- Search -->

<div class="search_form" id="form_base">

<label>Search</label>

<div class="fit-textinput-unit">

<input type="text" placeholder="Search Artists or Videos" >

<div class="fit-clear-btn"><a href="#">Delete</a></div>

</div>

</div>

<!--// Search -->

</div>


</div>

</header>


<div id="content" class="subContent">


<div id="contWrap">


<!-- flicking view start -->


<div class="swiper-container">


<div class="swiper-pagination"></div>


<div class="swiper-wrapper">

<div class="swiper-slide">


<div id="now" class="wrap id_now"></div>


</div>

<div class="swiper-slide">Slide 2</div>

<div class="swiper-slide">Slide 3</div>

<div class="swiper-slide">Slide 4</div>

</div>


</div>


<!-- flicking view End -->

</div>

</div>


<div id="footer">

<a href="#" class="spr btnTop">Top</a>

</div>


</div>


</body>

</html>

반응형
반응형

안드로이드 스튜디오 @android:style/Theme.NoTitleBar


기본적인요 테마가 안먹는다..


시작하자마자 뻗어버림 ...


폭풍검색 ActionActivity 를 상속하면서 생기는 버그? 오류?


아 한시간 달려먹고 검색해서 찾음 ㅠㅠ


아래 참고 사이트..


[Android Studio] 'Theme.NoTitleBar' 작업 시 'You need to use a Theme.AppCompat theme' 에러



Android Studio 에서 프로젝트를 생성 후 TitleBar 를 없애기 위해서
AndroidManifest.xml 의 Activity 에 다음과 같이 기술했었다.

android:theme="@android:style/Theme.NoTitleBar"

하지만 황당하게도 에러가 발생을 하면서 앱이 종료가 된다.


http://1004lucifer.blogspot.kr/2013/11/android-studio-themenotitlebar-you-need.html

http://stackoverflow.com/questions/22828118/app-crashes-after-setting-to-theme-notitlebar-fullscreen


No titlebar 적용 방법 






http://www.okedroid.com/2014/12/cara-menghilangkan-title-bar-pada-activity.html

반응형
반응형


전역 변수 

__filename  현재 실행 중인 코드의 파일 경로

__dirname   현재 실행 중인 코드의 폴더 경로


console.log 로 출력 가능


console.log('file' ,__filename);


전역객체

console    콘솔 화면 기능  

exports     모듈 관련

process    프로그램 관련 

반응형
반응형

기종 : cent os 6.5


우선 node.js 설치 (root 계정으로 설치)


소스 컴파일 방법입니다.

~$ wget http://nodejs.org/dist/v0.10.28/node-v0.10.28.tar.gz

~$ tar vxzf node-v0.10.28.tar.gz

~$ cd node-v0.10.28

~/node-v0.10.28$ ./configure

~/node-v0.10.28$ make

~/node-v0.10.28$ sudo make install


다음은 apt-get을 이용한 인스톨방법입니다.

$ sudo apt-get install nodejs

$ sudo apt-get install npm



참고 링크 : http://pyrasis.com/nodejs/nodejs-HOWTO#section-8


node.js path 설정.. 


설치 완료 테스트 node -v  

버젼 나오면 성공


간단히 서버 만들어서 테스트 해볼까 했는데...

외부 접근이 안됨 !!!! 머지 ( 팀장닷컴 가상서버 이용중)

팀장닷컴 고객센터 포트포워딩 요청 ... 해결  -0-;;;


npm 으로 각종 소스 형태? 설치


npm install -g express와 같이 -g 옵션을 주면 Node.js 설치 디렉터리에 모듈이 설치됩니다. 

전역 모듈 설치라고 하는데 이렇게 설치하면 app.js 디렉터리와 상관없이 모듈을 사용


express 설치 오류가 나면 ( npm install -g express-generator )


npm install express

npm install date-utils


npm install node-gcm


설치 후 간단한 푸시 테스트 


push.js

    

var gcm = require('node-gcm');

// create a message with default values

var message = new gcm.Message();


// or with object values

var message = new gcm.Message({

    collapseKey: 'demo',

    delayWhileIdle: true,

    timeToLive: 3,

    data: {

        key1: '안녕하세요.',

        key2: 'saltfactory push demo'

    }

});


var server_access_key = '푸시 프로바이더 서버 access key 값';

var sender = new gcm.Sender(server_access_key);

var registrationIds = [];


var registration_id = '안드로이드 registration_id 값';

// At least one required

registrationIds.push(registration_id);


/**

 * Params: message-literal, registrationIds-array, No. of retries, callback-function

 **/

sender.send(message, registrationIds, 4function (err, result) {

    console.log(result);

});


node push.js  로 테스트...





그리고 또다른 서버 설정 pm2 

node.js 는 오류나 내가 나가거나 ctrl+c 하면 서비스가 죽어버린다...

키워드 리눅스 실행 및 부팅시 자동실행  Keep Alive 

Install PM2

$ npm install pm2 -g

npm is a builtin CLI when you install Node.js - Installing Node.js or io.js with NVM

Start an application

$ pm2 start app.js

Main features

Process management

Once apps are started you can list and manage them easily:

Process listing

Listing all running processes:

$ pm2 list

Managing your processes is straightforward:

$ pm2 stop     <app_name|id|all>
$ pm2 restart  <app_name|id|all>
$ pm2 delete   <app_name|id|all>

To have more details on a specific process:

$ pm2 describe 0

Monitoring

Monit

Monitoring all processes launched:

$ pm2 monit

Log facilities

Monit


Startup script generation

PM2 can generate and configure a startup script to keep PM2 and your processes alive at every server restart.

$ pm2 startup
# auto-detect platform
$ pm2 startup [platform]
# render startup-script for a specific platform, the [platform] could be one of:
#   ubuntu|centos|redhat|gentoo|systemd|darwin|amazon

To save a process list just do:

$ pm2 save

centos 는

pm2 startup centos 하면 된다 ~


개 편함 ~!!


참고 URL

(node.js 기본코드를 볼 수 있는곳 많은 도움이 되었다.)

http://cinema4dr12.tistory.com/category/Programming/Web%20App


https://github.com/Unitech/pm2 

http://wingsnote.com/m/post/59






반응형
반응형

- UNABLE_TO_VERIFY_LEAF_SIGNATURE 가 발생할 경우

 아래 명령어 ...ssl 을 사용 안하겠다는거 ~
npm config set strict-ssl false


요거 후 다시 

npm install express 하면 자~~알 된다 자알~~

반응형
반응형



참고한 강좌







이클립스보다 뭔가 좀 직관적으로 바뀌었네..




위 강좌는 리눅스 (mac) 기준으로 윈도우 사용자에 대한 배려가 없다 ㅋㅋㅋ


우선 keystore 파일을 만든다..


Java 가 가지고 있는 keytool 유틸리티로 keystore 를 생성해줍니다.

시작 > 실행 > cmd  ( java path가 설정되어있어야함 ..)

keytool -genkey -v -keystore test.keystore -alias komvo -keyalg RSA -keysize 2048 -validity 10000

요거 복사해서 붙여넣기 차례대로 입력...


키 저장소 비밀번호 입력:  

새 비밀번호 다시 입력: 

이름과 성을 입력하십시오.

  [Unknown]:  nova

조직 단위 이름을 입력하십시오.

  [Unknown]:  

조직 이름을 입력하십시오.

  [Unknown]:  

구/군/시 이름을 입력하십시오?

  [Unknown]:  

시/도 이름을 입력하십시오.

  [Unknown]:  

이 조직의 두 자리 국가 코드를 입력하십시오.

  [Unknown]:  

CN=nova, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown이(가) 맞습니까?

  [아니오]:  y


다음에 대해 유효 기간이 10,000일인 2,048비트 RSA 키 쌍 및 자체 서명된 인증서(SHA256withRSA)를 생성하는 중

: CN=nova, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown

<nova>에 대한 키 비밀번호를 입력하십시오.

(키 저장소 비밀번호와 동일한 경우 Enter 키를 누름):  

[test.keystore을(를) 저장하는 중]



그 후


안드스튜디오에서  왼쪽 모드를 안드로이드 모드에서 > 프로젝트 모드로 변경


app 폴더 아래에 keystore 폴더를 만들어준다..


그 후 아래 파일 처럼 셋팅





헉헉 힘드러


그후 터미널 선택 후 

윈도우 사용자면 gradlew aR 입력 하면 어셈릴리즈 ~? 


프로젝트\app\build\outputs\apk\ 에 사인된 apk 가 있다 


끝~~

아래 출처에 자세히 있어요 잘 안되면 참고 하세용



출처

http://novafactory.net/archives/3143

반응형
반응형

Error:Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon athttp://gradle.org/docs/1.10/userguide/gradle_daemon.html
Please read below process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit



노트북에서는 애러가 없었는데 데스크탑에서 애러발생..

앜 머지 ~


모든 프로젝트 종료 > Settings > Compiler > Gradle > VM Option 을 -Xmx512m 로 세팅
Settings > Gradle > Gradle VM Option 에 -Xmx512m 세팅


요거나


In Eclipse, go to windows -> preferences -> gradle->arguments. Find JVM Arguments choose from radio button "USE :" and write arguments -Xms128m -Xmx512m Then click button Apply


두개로 해결 ;;;


출처

http://shinyryu09.blogspot.kr/2014/05/gradle-error-unrecognized-jvm-option-is.html

http://stackoverflow.com/questions/20471311/android-studio-unable-to-start-the-daemon-process

반응형
반응형







소스 코드


 @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

    }


    public void onButtonClicked(View v){

        //뿌려줄 공간 layout id로 찾아온다.이미 메인에서 메모리에 올라 갔으니 찾을 수 있다.

        LinearLayout container = (LinearLayout)findViewById(R.id.container);

        

        //시스템서비스 에서(getSystemService) 참조된 특정 객체를 가져온다

        LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);


        //sub_layout.xml 에있는것 메모리에 객체화 (가져온것 메모리에 올린다..)

        // 객체화 시킨것 activity_main 에서 만든 LineLayout container 여기에 뿌린다.

        inflater.inflate(R.layout.sub_layout,container,true);


        Button btn2  = (Button) findViewById(R.id.button2);


        btn2.setOnClickListener(new View.OnClickListener() {

            @Override

            public void onClick(View v) {

                Toast.makeText(getApplicationContext(),"내부 클릭",Toast.LENGTH_SHORT).show();

            }

        });

    }

반응형

+ Recent posts