1. Fyneworks Multiple File Upload
URL : https://www.fyneworks.com/jquery/multiple-file-upload/


2. Blueimp jQuery File Upload
URL : http://blueimp.github.io/jQuery-File-Upload/


3. Uploadify
URL : http://www.uploadify.com/


4. Plupload
URL : http://www.plupload.com/

출처 : http://blog.naver.com/PostView.nhn?blogId=romeoyo&logNo=120188644234

Jquery UI 를 이용해 서비스 개발 작업을 하고 있는데. 어처구니없는 난관에 봉착했다.

무려 $99를 지불하고 구입한 RedActor html 에디터를 Jquery UI의 다이얼로그에 심었더니 이미지 URL삽입 같은 자체 UI의 입력란에 포커스가 가지 않는것이다.

무슨 유료 라이브러리가 이래 허접할까 툴툴대고 있었는데 범인은 Jquery UI 로 판명났다.

 

아래가 그 증상이다.

당신이 클릭의 신이어도 절대로 "이미지링크" 입력란에 포커스가 가지 않는다. (IE에서는 클릭하면 가긴 간다)

 

이틀정도 삽질하다가 구글신이 답을 주셨다.

아래가 정상적으로 포커스가 간 것이다.

 

Jquery, Jquery UI 라이브러리를 로딩하고 아래의 한줄을 추가해 주면 된다.


$.ui.dialog.prototype._focusTabbable = function(){};

 

잉글리쉬에 능숙하다면 아래 자료를 봐도 된다. Fix되었고, 관련 옵션이 추가되었다고 하는데. 내가 쓰는 Jquery UI 1.10.2 는 문제가 있으며, 공식 API문서에도 관련 옵션을 못찾겠다 꾀꼬리.

 

http://bugs.jqueryui.com/ticket/4731


출처 : http://ygang.tistory.com/109

기본적으로 JavaScript 코드는 자신이 로드된 도메인만 통신이 가능하고, 크로스 도메인(다른 도메인)과는 통신할 수 없다. 이것은 동일 출처 정책이라고 한다. 이것은 AJAX 통신에도 그대로 적용된다. 보안 관점에서 동일 출처 정책은 악의적인 JavaScript 코드가 다른 도메인의 데이터에 대한 무단 액세스를 할 수 없도록 한다는 점에서는 매우 효과적이다.

이 정책은 두 가지 형태의 웹앱에서는 장애물이 된다.

첫번째는 여러가지 Open API에 접근해서 클라이언트 매시업 기능을 필요로 하는 웹액에서는 장애물이 된다.

두번째는 웹앱을 네이트브앱으로 만들 경우 기기의 로컬에서 로딩된 자바스크립트는 외부 서버에서 엑세스 할 수 없다. 

 

  <script type="text/javascript">
    $(document).bind("mobileninit",function(){
      $.support.cors =true;
      $.mobile.allowCrossDomainPages = true;
    });
 </script>

 

$.support.cors-true 는 jQuery의 $.ajax() 메소드가 크로스 도메인 페이지를 로드할 수 있도록 해준다. 그리고 $.mobile.allowCrossDomainPage=true 는 jQuery Mobile API가 크로스 도메인 페이지를 로드할 수 있도록 해 준다.

jQuery Mobile 웹액을 네이티브앱으로 변활할 경우 주의할 점은 시작 HTML(홈페이지)에 기술된 다른 페이지로의 링크 경로를 크로스 도메인 절대 경로로 변경해야 한다.


 

nstore_app_slide.zip


참고 : http://nstore.naver.com


 

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Insert title here</title>

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<style>
body, input, textarea, select, button, table {
    font-family: '돋움',Dotum,Helvetica,sans-serif;
    font-size: 12px;
}
ul {list-style:none;}
a {text-decoration:none;}

.lst_thum_wrap {width:670px; float:left; margin:0 30px;}
.lst_thum_wrap .lst_thum {width:100%; margin:0; padding:16px 0 0 16px; position:relative;}
.lst_thum_wrap .lst_thum:after {display:block; clear:both; content:'';}
.lst_thum_wrap .lst_thum li {width:108px; margin:0; padding:0 26px 10px 0; float:left; position:relative; vertical-align:top;}
.lst_thum_wrap .lst_thum li .mask {display:block; overflow:hidden; position:absolute; width:102px; height:102px; background:url('images/sp_mask.png') no-repeat -325px 0;}
.lst_thum_wrap .lst_thum li .ico {top:-10px; left:-12px; position:absolute; z-index:20; width:41px; height:41px; background:url('images/sp_sub_common.png') no-repeat; font-style:normal;}
.lst_thum_wrap .lst_thum li .ico_new {background-position: -184px -299px;}
.lst_thum_wrap .lst_thum li .ico_free {background-position: -92px -299px;}
.lst_thum_wrap .lst_thum li .ico_gift {background:url('images/sp_ico.png') no-repeat -120px 0;}
.lst_thum_wrap .lst_thum li .ico_vari {line-height:22px !important; font-family:Tahoma !important; font-size:10px; font-weight:bold; padding-top:8px; color:#fff; height:41px; background-position:-46px -299px; text-align:center;}
.lst_thum_wrap .lst_thum li a img {width:101px; height:101px; margin:1px 0 5px 1px;}
.lst_thum_wrap .lst_thum li a img + strong {padding:5px 0 0; line-height:18px; word-break:break-all; display:block; color:#000; white-space:normal;}
.lst_thum_wrap .lst_thum li .writer {display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;}
.lst_thum_wrap .lst_thum li .score {margin:0 0 0 -1px; display:inline-block; position:relative; width:61px; height:12px; background:url('images/sp_sub_common.png') no-repeat -732px -249px; vertical-align:middle; font-size:11px; font-weight:bold; color:#333;}
.lst_thum_wrap .lst_thum li .score span {display:block; overflow:hidden; position:relative; height:12px; background:url('images/sp_sub_common.png') no-repeat -732px -232px; line-height:999px;}
.lst_thum_wrap .lst_thum li .score_num {display:inline-block; position:relative; top:1px; font-weight:bold; font-size:11px; color:#333; vertical-align:middle; font-style:normal; left:-2px;}
.lst_thum_wrap .lst_thum li .price {display:block; margin: 4px 0 0 -2px; line-height:16px; text-align:left; white-space: normal;}
.lst_thum_wrap .lst_thum li .price strong {word-break:break-all; color:#1b8ffc;}


.flick-carousel {width:730px; position:relative; height:244px;}
.flick-carousel .flick-carousel-outer-container {overflow:hidden; position:absolute; width:730px; height:230px;}
.flick-carousel .flick-carousel-outer-container .flick-carousel-content-container {height:230px; width:10000px; white-space:nowrap;}
.flick-carousel a.flick-button-previous,
.flick-carousel a.flick-button-next {position:absolute; top:65px; width:27px; height:43px; background:url('images/sp_alsobought_bs_v2.png') no-repeat; line-height:999px; overflow:hidden; z-index:30; display:none;}
.flick-carousel a.flick-button-previous {background-position:5px -108px;}
.flick-carousel a.flick-button-previous:hover {background-position:-22px -108px;}
.flick-carousel a.flick-button-next {background-position:-49px -108px; right:0;}
.flick-carousel a.flick-button-next:hover {background-position:-76px -108px;}
.flick-carousel .flick-nav {position:absolute; bottom:6px; left:0; width:100%; margin:0; text-align:center; display:none;}
.flick-carousel .flick-nav strong,
.flick-carousel .flick-nav a {display:inline-block; overflow:hidden; width:7px; height:7px; margin:0; line-height:999px; vertical-align:middle; background:url('images/sp_alsobought_as.png') no-repeat;}
.flick-carousel .flick-nav strong {background-position:-108px -46px;}
.flick-carousel .flick-nav a {background-position:-119px -46px;}
</style>

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<script>
jQuery(function($) {
 $.fn.extend({
  flick : function(opt) {
   var settings = {
    speed : 400
   }
   $.extend(true, settings, opt);
   
   var _this = $(this);
   var _outer = _this.find('.flick-carousel-outer-container');
   var _content = _outer.find('.flick-carousel-content-container');
   var _items = _content.find('.lst_thum_wrap');
   var itemsLen = _items.length;
   if(itemsLen < 2) {
    return false;
   }
   var itemsAvg = Math.floor(itemsLen/2);
   var _btnPrev = _this.find('.flick-button-previous');
   var _btnNext = _this.find('.flick-button-next');
   var _btnNav = _this.find('.flick-nav');
   var pos = 0;
   var idx = 0;
   var posIdx = 0;
   var moveItem = 0;
   var movePos = 0;
   var outerWidth = _outer.width();
   var itemWidth = _items.eq(0).outerWidth(true);
   var contentWidth = itemWidth * _items.length;
   var lastPos = contentWidth - outerWidth;
   _content.width(contentWidth);
   _btnPrev.add(_btnNext).add(_btnNav).show();
   
   _btnPrev.on('click', function(e) {
    e.preventDefault();
    
    var nIdx = idx-1;
    if(nIdx < 0) {
     nIdx = itemsLen - 1;
    }
    setNav(nIdx);
   });
   
   _btnNext.on('click', function(e) {
    e.preventDefault();
    
    var nIdx = idx+1;
    if(nIdx >= itemsLen) {
     nIdx = 0;
    }
    setNav(nIdx);
   });
   
   function prev() {
    if(moveItem > 0) {
     for(var i=0; i<moveItem; i++) {
      _content.find('.lst_thum_wrap').last().prependTo(_content);
     }
     _outer.scrollLeft(pos + itemWidth * movePos);
     //console.log('이전 이동 > moveItem : ' + moveItem + ', pos : ' + (pos + itemWidth * movePos) + ' > ' + pos);
    }
    
    _outer.stop().animate({
     scrollLeft : pos
    }, {
     duration:settings.speed,
     easing : 'easeOutExpo'
    });
   }
   
   function next() {
    if(moveItem > 0) {
     for(var i=0; i<moveItem; i++) {
      _content.find('.lst_thum_wrap').first().appendTo(_content);
     }
     _outer.scrollLeft(pos - itemWidth * movePos);
     //console.log('다음 이동 > moveItem : ' + moveItem + ', pos : ' + (pos - itemWidth * movePos) + ' > ' + pos);
    }
    
    _outer.stop().animate({
     scrollLeft : pos
    }, {
     duration:settings.speed,
     easing : 'easeOutExpo'
    });
   }
   
   function setNav(nIdx) {
    var _navBefore = _btnNav.children().eq(idx);
    _navBefore.replaceWith($('<a />', {href : '#'}).text(idx));
    var _navAfter = _btnNav.children().eq(nIdx);
    _navAfter.replaceWith($('<strong />').text(nIdx));
    
    movePos = nIdx - idx;
    if(movePos > 0) {
     if(movePos <= itemsAvg) {
      posIdx += movePos;
      if(posIdx >= itemsLen) {
       moveItem = posIdx - itemsLen + 1;
       posIdx = itemsLen - 1;
       pos = lastPos;
      } else {
       moveItem = 0;
       pos += itemWidth * movePos;
      }
      //console.log('다음(큰) > moveItem : ' + moveItem + ', posIdx : ' + posIdx);
      next();
     } else {
      var befPosIdx = posIdx;
      posIdx = posIdx + movePos - itemsLen;
      movePos = befPosIdx - posIdx;
      if(posIdx < 0) {
       moveItem = Math.abs(posIdx);
       posIdx = 0;
       pos = 0;
      } else {
       moveItem = 0;
       pos -= itemWidth * movePos;
      }
      //console.log('이전(큰) > moveItem : ' + moveItem + ', posIdx : ' + posIdx);
      prev();
     }
    } else {
     movePos = Math.abs(movePos);
     if(movePos > itemsAvg) {
      var befPosIdx = posIdx;
      posIdx = posIdx - movePos + itemsLen;
      movePos = posIdx - befPosIdx;
      if(posIdx >= itemsLen) {
       moveItem = posIdx - itemsLen + 1;
       posIdx = itemsLen - 1;
       pos = lastPos;
      } else {
       moveItem = 0;
       pos += itemWidth * movePos;
      }
      //console.log('다음(작은) > moveItem : ' + moveItem + ', posIdx : ' + posIdx);
      next();
     } else {
      posIdx -= movePos;
      if(posIdx < 0) {
       moveItem = Math.abs(posIdx);
       posIdx = 0;
       pos = 0;
      } else {
       moveItem = 0;
       pos -= itemWidth * movePos;
      }
      //console.log('이전(작은) > moveItem : ' + moveItem + ', posIdx : ' + posIdx);
      prev();
     }
    }
    idx = nIdx;
   }
   
   $(_btnNav).on('click', 'a', function(e) {
    e.preventDefault();
    var _this = $(this);
    setNav(parseInt(_this.text(), 10));
   });
   
  }
 });
 
 $('.flick-carousel').flick();
});
</script>

</head>
<body>

<div class="flick-carousel">
 <a href="#" class="flick-button-previous"></a>
 <div class="flick-carousel-outer-container">
  <div class="flick-carousel-content-container">
   <div class="lst_thum_wrap a0">
    <ul class="lst_thum">
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_new"></em>
       <img src="images/app1.png" />
       <strong class="bb">000</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <img src="images/app2.png" />
       <strong class="bb">[건비트2] 음악 게임의 신세계</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_gift"></em>
       <img src="images/app3.png" />
       <strong class="bb">이츄, 사랑의 홍차 연구소</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_free"></em>
       <img src="images/app4.png" />
       <strong class="bb">미투데이</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <img src="images/app5.png" />
       <strong class="bb">앱</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
    </ul>
   </div>
   <div class="lst_thum_wrap a1">
    <ul class="lst_thum">
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_new"></em>
       <img src="images/app6.png" />
       <strong class="bb">111</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <img src="images/app7.png" />
       <strong class="bb">네이버 블로그</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_gift"></em>
       <img src="images/app8.png" />
       <strong class="bb">이츄, 사랑의 홍차 연구소</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_free"></em>
       <img src="images/app9.png" />
       <strong class="bb">미투데이</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <img src="images/app10.png" />
       <strong class="bb">앱</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
    </ul>
   </div>
   <div class="lst_thum_wrap a2">
    <ul class="lst_thum">
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_new"></em>
       <img src="images/app11.png" />
       <strong class="bb">222</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <img src="images/app12.png" />
       <strong class="bb">네이버 블로그</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_gift"></em>
       <img src="images/app13.png" />
       <strong class="bb">이츄, 사랑의 홍차 연구소</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_free"></em>
       <img src="images/app14.png" />
       <strong class="bb">미투데이</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <img src="images/app15.png" />
       <strong class="bb">앱</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
    </ul>
   </div>
   <div class="lst_thum_wrap a3">
    <ul class="lst_thum">
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_new"></em>
       <img src="images/app11.png" />
       <strong class="bb">333</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <img src="images/app12.png" />
       <strong class="bb">네이버 블로그</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_gift"></em>
       <img src="images/app13.png" />
       <strong class="bb">이츄, 사랑의 홍차 연구소</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_free"></em>
       <img src="images/app14.png" />
       <strong class="bb">미투데이</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <img src="images/app15.png" />
       <strong class="bb">앱</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
    </ul>
   </div>
   <div class="lst_thum_wrap a4">
    <ul class="lst_thum">
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_new"></em>
       <img src="images/app11.png" />
       <strong class="bb">444</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <img src="images/app12.png" />
       <strong class="bb">네이버 블로그</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_gift"></em>
       <img src="images/app13.png" />
       <strong class="bb">이츄, 사랑의 홍차 연구소</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <em class="ico ico_free"></em>
       <img src="images/app14.png" />
       <strong class="bb">미투데이</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
     <li>
      <a href="#" title="앱이름">
       <span class="mask"></span>
       <img src="images/app15.png" />
       <strong class="bb">앱</strong>
      </a>
      <span class="writer">카테고리</span>
      <span class="score">
       <span style="width:84%;">평점</span>
      </span>
      <em class="score_num">4.2</em>
      <span class="price">
       <strong>무료</strong>
      </span>
     </li>
    </ul>
   </div>
  </div>
 </div>
 <a href="#" class="flick-button-next"></a>
 <span class="flick-nav">
  <strong>0</strong>
  <a href="#">1</a>
  <a href="#">2</a>
  <a href="#">3</a>
  <a href="#">4</a>
 </span>
</div>


</body>
</html> 

 

 

 

google_screenshot.zip

index.html

출처 : https://play.google.com/

 

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Insert title here</title>

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<style>
.screenshot-carousel {position:relative; height:400px; width:650px;}
.screenshot-carousel .screenshot-carousel-outer-container {height:400px; overflow:hidden; position:absolute; width:650px;}
.screenshot-carousel .screenshot-carousel-outer-container .screenshot-carousel-content-container {height:400px; width:10000px; white-space:nowrap;}
.screenshot-carousel .screenshot-carousel-outer-container .screenshot-carousel-content-container .screenshot-image-wrapper {
 display:inline-block; float:left;
}
.screenshot-carousel .screenshot-carousel-outer-container .screenshot-carousel-content-container .screenshot-image-wrapper .screenshot-image {
 display:inline-block; max-height:400px; max-width:250px; vertical-align:bottom; padding-right:10px; border:0; margin:0;
}
.screenshot-carousel .screenshot-carousel-button-previous,
.screenshot-carousel .screenshot-carousel-button-next,
.screenshot-carousel .screenshot-carousel-left-fade,
.screenshot-carousel .screenshot-carousel-right-fade {position:absolute;}
.screenshot-carousel .screenshot-carousel-button-previous,
.screenshot-carousel .screenshot-carousel-button-next {margin-top:184px; z-index:20; cursor:pointer;}
.screenshot-carousel .screenshot-carousel-button-previous {background:no-repeat url('images/sprites.png') -248px 0; height:32px; width:32px; display:none;}
.screenshot-carousel .screenshot-carousel-button-next {background:no-repeat url('images/sprites.png') -91px -266px; height:32px; width:32px; right:0; display:none;}
.screenshot-carousel .screenshot-carousel-left-fade,
.screenshot-carousel .screenshot-carousel-right-fade {width:50px; height:400px; z-index:10; cursor:pointer;}
.screenshot-carousel .screenshot-carousel-left-fade {display:none;}
.screenshot-carousel .screenshot-carousel-right-fade {right:0; display:none;}
/* -moz-opacity:0.4;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);margin-top:70px;opacity:0.4 */
</style>

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<script>
(function($) {
 $.fn.extend({
  screenshot : function(opt) {
   var settings = {
    speed : 400
   }
   $.extend(true, settings, opt);
   
   var _this = $(this);
   var _outer = _this.find('.screenshot-carousel-outer-container');
   var _content = _outer.find('.screenshot-carousel-content-container');
   var _wrapper = _content.find('.screenshot-image-wrapper');
   var _leftFade = _this.find('.screenshot-carousel-left-fade');
   var _rightFade = _this.find('.screenshot-carousel-right-fade');
   var _btnPrev = _this.find('.screenshot-carousel-button-previous').add(_leftFade);
   var _btnNext = _this.find('.screenshot-carousel-button-next').add(_rightFade);
   var pos = 0;
   var outerWidth = _outer.width();
   //var wrapperWidth = _wrapper.eq(0).outerWidth(true);
   var wrapperWidth = _wrapper.eq(0).width();
   var contentWidth = wrapperWidth * _wrapper.length;
   _content.width(contentWidth);
   
   if(contentWidth > outerWidth) {
       _btnNext.show();
   } else {
       return false;
   }
   
   _btnPrev.on({
    'mouseenter' : function() {
     _leftFade.stop().animate({width:75}, {duration:100});
    },
    'mouseleave' : function() {
     _leftFade.stop().animate({width:50}, {duration:100});
    },
    'click' : function() {
     if(pos == contentWidth - outerWidth) {
      pos -= 450;
     } else {
      pos -= wrapperWidth * 2;
     }
     
     if(pos < 0) {
      pos = 0;
      _btnPrev.hide();
     }
     
     _outer.stop().animate({
      scrollLeft : pos
     }, {
      duration:settings.speed,
      easing : 'easeOutExpo'
     });
     _btnNext.show();
    }
   });
   
   _btnNext.on({
    'mouseenter' : function() {
     _rightFade.stop().animate({width:75}, {duration:100});
    },
    'mouseleave' : function() {
     _rightFade.stop().animate({width:50}, {duration:100});
    },
    'click' : function() {
     if(pos == 0) {
      pos += 450;
     } else {
      pos += wrapperWidth * 2;
     }
     
     if(pos + outerWidth > contentWidth) {
      pos = contentWidth - outerWidth;
      _btnNext.hide();
     }
     
     _outer.stop().animate({
      scrollLeft : pos
     }, {
      duration:settings.speed,
      easing : 'easeOutExpo'
     });
     _btnPrev.show();
    }
   });
   
  }
 });
})(jQuery);

jQuery(function($) {
 $('.screenshot-carousel').screenshot();
});
</script>

</head>
<body>

<div class="screenshot-carousel">
 <div class="screenshot-carousel-button-previous"></div>
 <img src="images/left_fade.png" class="screenshot-carousel-left-fade" />
 <div class="screenshot-carousel-outer-container">
  <div class="screenshot-carousel-content-container">
   <div class="screenshot-image-wrapper"><img src="images/screenshot5.png" class="screenshot-image" /></div>
   <div class="screenshot-image-wrapper"><img src="images/screenshot1.png" class="screenshot-image" /></div>
   <div class="screenshot-image-wrapper"><img src="images/screenshot2.png" class="screenshot-image" /></div>
   <div class="screenshot-image-wrapper"><img src="images/screenshot3.png" class="screenshot-image" /></div>
   <div class="screenshot-image-wrapper"><img src="images/screenshot4.png" class="screenshot-image" /></div>
   <div class="screenshot-image-wrapper"><img src="images/screenshot1.png" class="screenshot-image" /></div>
   <div class="screenshot-image-wrapper"><img src="images/screenshot2.png" class="screenshot-image" /></div>
   <div class="screenshot-image-wrapper"><img src="images/screenshot3.png" class="screenshot-image" /></div>
   <div class="screenshot-image-wrapper"><img src="images/screenshot4.png" class="screenshot-image" /></div>
   <div class="screenshot-image-wrapper"><img src="images/screenshot1.png" class="screenshot-image" /></div>
   <div class="screenshot-image-wrapper"><img src="images/screenshot2.png" class="screenshot-image" /></div>
   <div class="screenshot-image-wrapper"><img src="images/screenshot3.png" class="screenshot-image" /></div>
  </div>
 </div>
 <img src="images/right_fade.png" class="screenshot-carousel-right-fade" />
 <div class="screenshot-carousel-button-next"></div>
</div>

</body>
</html>

 

 

tstore_screenshot1.zip  

 tstore_screenshot2.zip


tstore_screenshot1 : tstore에 있는 방식대로 처리, 속도가 느리고 이미지 하나씩 슬라이딩 됨
tstore_screenshot2 : tstore에 있는 방식을 개선하여 처리, 속도 및 이미지 맞춤 개선

출처 : http://www.tstore.co.kr 

 

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Insert title here</title>

<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<style>
.scnshot_wrap {
 width:532px;
 height:350px;
 position:relative;
}
.scnshot_wrap .scnshot_outer {
 width:530px;
 border-left:1px solid #3a3a3a;
 overflow:hidden;
}
.scnshot_wrap .scnshot_outer ul {
 width:10000px;
 margin:0;
 padding:0;
}
.scnshot_wrap .scnshot_outer ul li {
 float:left;
 display:inline-block;
 overflow:hidden;
}
.scnshot_wrap .scnshot_outer img {
 width:220px;
 height:350px;
 border:0;
 margin-right:5px;
}
.scnshot_wrap .scnshot_prev {
 position:absolute;
 top:145px;
 left:0;
 z-index:10;
 display:none;
}
.scnshot_wrap .scnshot_next {
 position:absolute;
 top:145px;
 right:0;
 z-index:10;
 display:none;
}
</style>

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<script>
(function ($) {
 $.fn.extend({
  thumbnailSlide : function(opt) {
   var settings = {
    speed : 400
   }
   $.extend(true, settings, opt);
   
   var _this = $(this);
   var _outer = _this.find('.scnshot_outer');
   var _content = _outer.find('ul');
   var _item = _content.find('li');
   if(_item.length < 1) {
    return false;
   }
   var _btnPrev = _this.find('.scnshot_prev');
   var _btnNext = _this.find('.scnshot_next');
   var pos = 0;
   var outerWidth = _outer.width();
   var itemWidth = _item.eq(0).width();
   var contentWidth = itemWidth * _item.length;
   _content.width(contentWidth);
   
   if(contentWidth - 5 > outerWidth) {
    _btnNext.show();
   } else {
    return false;
   }
   _outer.css({borderRight:'1px solid #3a3a3a'});
   
   _btnPrev.on('click', function() {
    if(pos == contentWidth - outerWidth - 5) {
     pos -= 420;
    } else {
     pos -= itemWidth * 2;
    }
    
    if(pos < 0) {
     pos = 0;
     _btnPrev.hide();
    }
    
    _outer.stop().animate({
     scrollLeft : pos
    }, {
     duration:settings.speed,
     easing : 'easeOutExpo'
    });
    _btnNext.show();
   });
   
   _btnNext.on('click', function() {
    if(pos == 0) {
     pos += 420;
    } else {
     pos += itemWidth * 2;
    }
    
    if(pos + outerWidth > contentWidth) {
     pos = contentWidth - outerWidth - 5;
     _btnNext.hide();
    }
    
    _outer.stop().animate({
     scrollLeft : pos
    }, {
     duration:settings.speed,
     easing : 'easeOutExpo'
    });
    _btnPrev.show();
   });
  }
 });
})(jQuery);

jQuery(function($) {
 $('.scnshot_wrap').thumbnailSlide();
});
</script>

</head>
<body>

<div class="scnshot_wrap">
 <a href="#" class="scnshot_prev">
  <img src="images/btn_prev05.png" alt="이전" />
 </a>
 <div class="scnshot_outer">
  <ul>
   <li><img src="images/screenshot1.png" /></li>
   <li><img src="images/screenshot2.png" /></li>
   <li><img src="images/screenshot3.png" /></li>
   <li><img src="images/screenshot4.png" /></li>
   <li><img src="images/screenshot5.png" /></li>
   <li><img src="images/screenshot1.png" /></li>
   <li><img src="images/screenshot2.png" /></li>
   <li><img src="images/screenshot3.png" /></li>
   <li><img src="images/screenshot4.png" /></li>
   <li><img src="images/screenshot5.png" /></li>
  </ul>
 </div>
 <a href="#" class="scnshot_next">
  <img src="images/btn_next05.png" alt="다음" />
 </a>
</div>


</body>
</html>

 

 

참고 : http://buildinternet.com/2009/03/sliding-boxes-and-captions-with-jquery/
데모 : http://s3.amazonaws.com/buildinternet/live-tutorials/sliding-boxes/index.htm

Source : slidingBoxes.zip

 

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Insert title here</title>

<style>
.img_box{}
.img_box article {width:300px; height:250px; position:relative; float:left; margin:10px; overflow:hidden; border:solid 2px #8399af; background:#161613;}
.img_box article img {width:300px; height:250px; position:absolute; top:0; left:0; border:0;}
.img_box article .boxcaption {width: 100%; height:100px; position:absolute; top:250px; left:0; background: #000; opacity:.8; /* For IE 5-7 */ filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80 ); /* For IE 8 */-MS-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";}
.img_box article.caption .boxcaption {top:208px;}
.img_box article.captionfull .boxcaption {top:250px;}
.img_box article .boxcaption h3,
.img_box article.slideright h3,
.img_box article.thecombo h3,
.img_box article.slideup h3 {margin:10px 10px 4px 10px; color:#fff; font:22px Arial, sans-serif; letter-spacing:-1px; font-weight:bold;}
.img_box article .boxcaption p,
.img_box article.slideright p,
.img_box article.thecombo p,
.img_box article.slideup p {padding:0 10px; color:#afafaf; font-weight:bold; font:12px "Lucida Grande", Arial, sans-serif;}
.img_box article .boxcaption p a,
.img_box article.slideright p a,
.img_box article.thecombo p a,
.img_box article.slideup p a {color:#666;}
</style>

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
jQuery(function($) {
 $('.img_box article.caption').hover(function() {
  $('.cover', this).stop().animate({
   top : 150
  }, {
   queue : false,
   duration : 160
  });
 }, function() {
  $('.cover', this).stop().animate({
   top : 208
  }, {
   queue : false,
   duration : 160
  });
 });
 
 $('.img_box article.captionfull').hover(function() {
  $('.cover', this).stop().animate({
   top : 150
  }, {
   queue : false,
   duration : 160
  });
 }, function() {
  $('.cover', this).stop().animate({
   top : 250
  }, {
   queue : false,
   duration : 160
  });
 });
 
 $('.img_box article.slideright').hover(function() {
  $('.cover', this).stop().animate({
   left : 300
  }, {
   queue : false,
   duration : 300
  });
 }, function() {
  $('.cover', this).stop().animate({
   left : 0
  }, {
   queue : false,
   duration : 300
  });
 });
 
 $('.img_box article.thecombo').hover(function() {
  $('.cover', this).stop().animate({
   left : 300,
   top : 250
  }, {
   queue : false,
   duration : 300
  });
 }, function() {
  $('.cover', this).stop().animate({
   left : 0,
   top : 0
  }, {
   queue : false,
   duration : 300
  });
 });
 
 $('.img_box article.slideup').hover(function() {
  $('.cover', this).stop().animate({
   top : -250
  }, {
   queue : false,
   duration : 300
  });
 }, function() {
  $('.cover', this).stop().animate({
   top : 0
  }, {
   queue : false,
   duration : 300
  });
 });
 
 $('.img_box article.peek').hover(function() {
  $('.cover', this).stop().animate({
   top : 90
  }, {
   queue : false,
   duration : 160
  });
 }, function() {
  $('.cover', this).stop().animate({
   top : 0
  }, {
   queue : false,
   duration : 160
  });
 });
 
});
</script>

</head>
<body>

<section class="img_box">
 <article class="captionfull">
  <img src="images/florian.jpg" />
  <div class="cover boxcaption">
   <h3>타이틀1</h3>
   <p>
    내용입니다.<br />
    <a href="">내용입니다.</a>
   </p>
  </div>
 </article>
 
 <article class="caption">
  <img src="images/jareck.jpg" />
  <div class="cover boxcaption">
   <h3>타이틀2</h3>
   <p>
    내용입니다.<br />
    <a href="">내용입니다.</a>
   </p>
  </div>
 </article>
 
 <article class="slideright">
  <img src="images/kamil.jpg" class="cover" />
  <div>
   <h3>타이틀3</h3>
   <p>
    내용입니다.<br />
    <a href="">내용입니다.</a>
   </p>
  </div>
 </article>
 
 <article class="thecombo">
  <img src="images/martin.jpg" class="cover" />
  <div>
   <h3>타이틀4</h3>
   <p>
    내용입니다.<br />
    <a href="">내용입니다.</a>
   </p>
  </div>
 </article>
 
 <article class="slideup">
  <img src="images/nonsense.jpg" class="cover" />
  <div>
   <h3>타이틀5</h3>
   <p>
    내용입니다.<br />
    <a href="">내용입니다.</a>
   </p>
  </div>
 </article>
 
 <article class="peek">
  <img src="images/birss.jpg" style="height:90px;" />
  <img src="images/buildinternet.jpg" class="cover" />
 </article>
 
</section>

</body>
</html> 





 

 참고 : http://stackoverflow.com/questions/1275383/jquery-remove-select-options-based-on-another-select-selected-need-support-for

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">

jQuery(function($) {
    $('#sel1').on('change', function() {
        var val = this.value;
       
        if(val) {
            $.ajax({
                url:val + '.xml',
                type:'POST',
                dataType:'xml',
                success:function(xml) {
                    var sel2 = $('#sel2');
                    $('option', sel2).each(function(i) {
                        if(i > 0) {
                            $(this).remove();
                        }
                    });
                    $(xml).find('list data').each(function() {
                        sel2.append(
                            $('<option>').text($(this).text()).val($(this).text())
                        );
                    });
                },
                error:function() {
                    alert('error');
                }
            });
        } else {
            // selectbox 모두 비우기 $(select).empty();
            var sel2 = $('#sel2');
            $('option', sel2).each(function(i) {
                if(i > 0) {
                    $(this).remove();
                }
            });
        }
    });
});

</script>
</head>
<body>

<select id="sel1" name="sel1">
    <option value="">전체</option>
    <option value="korea">대한민국</option>
    <option value="usa">미국</option>
</select>

<select id="sel2" name="sel2">
    <option value="">전체</option>
</select>

</body>
</html> 

 

<?xml version="1.0" encoding="UTF-8" ?>
<list>
    <data>korea1</data>
    <data>korea2</data>
</list> 

 

<?xml version="1.0" encoding="UTF-8" ?>
<list>
    <data>usa1</data>
    <data>usa2</data>
    <data>usa3</data>
</list> 

 

 


출처 : http://mytory.co.kr/archives/812
         http://mytory.co.kr/archives/783
         http://stackoverflow.com/questions/3220995/jquery-document-onclick-doesnt-work-when-clicking-an-embed-flash-on-ie-bu

var $layerPopupObj = $('.layerPopupBox');
var left = ( $(window).scrollLeft() + ($(window).width() - $layerPopupObj.width()) / 2 );
var top = ( $(window).scrollTop() + ($(window).height() - $layerPopupObj.height()) / 2 );
$layerPopupObj.css({'left':left,'top':top, 'position':'absolute'});
$('body').css('position','relative').append($layerPopupObj);

jQuery의 .scrollLeft() 함수는 좌우로 스크롤된 화면이 왼쪽부터 몇 px인지 구하는 함수다. 보통은 0일 거다.

jQuery의 .scrollTop() 함수는 스크롤된 화면이 맨 위에서부터 몇 px인지 구하는 함수다.

jQuery의 .width() 함수는 너비를 구하는 함수인데, $(window).width() 를 하면 현재 화면의 너비를 구한다. 윈도우를 전체화면으로 하지 말고 사이즈를 줄여 놓고 값을 구해 보면 전체 가로 사이즈보다 작게 나오는 것을 알 수 있다.

jQuery의 .height() 함수 역시 마찬가지인데, $(window).height() 라고 하면 윈도우에서 메뉴바 같은 것들을 빼고 실제 사용되는 부분의 높이만 구해 준다. 나는 높이 800px 화면의 노트북을 사용한데, 실제 사용되는 영역은 675px이었다.


레이어를 Modal 처럼 띄우기 위한 배경 검은 막 씌우기

jQuery modal window를 만드는 튜토리얼에서 그 방법을 발견했다. 우리가 해왔던 방식하고 크게 다르지 않았다. 이것만 가지고 플러그인을 만들어 볼까 하는 생각도 들었다.

자, 반투명 검은 막을 만드는 방법은 간단하다.(예제부터 보길 바라면 아래 파일을 사용하면 된다.)

cfile25.uf.13211E484D4BC96836139F.html

일단, HTML의 어딘가에 아래 코드를 끼워 넣는다. 어디든 별 상관 없지만 찾기 편한 곳에 둬야 할 거다.

<div id="mask"></div>
 

다음은 CSS인데 아래처럼 해 준다.

#mask {
position:absolute;
left:0;
top:0;
z-index:9000;
background-color:#000;
display:none;
}
 

마지막으로 jQuery 코드를 짜 보자.

function wrapWindowByMask(){
//화면의 높이와 너비를 구한다.
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//마스크의 높이와 너비를 화면 것으로 만들어 전체 화면을 채운다.
$('#mask').css({'width':maskWidth,'height':maskHeight});
//애니메이션 효과
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow",0.8);
}
 

자, 위 함수를 사용하면 반투명의 검은 마스크가 나타날 것이다. 그럼 어떻게 닫을까?

두 가지가 있을 것이다.

1.mordal window의 닫기 버튼을 눌렀을 때

2.반투명 검은 막을 눌렀을 때

두 경우 모두를 지원하기 위해서 click할 때 일어나는 이벤트를 두 군데 걸어야겠다.

이건 원본에서 그냥 긁어 온 코드다. .window는 검은 막 위에 뜬 mordal window다.

//닫기 버튼을 눌렀을 때
$('.window .close').click(function (e) {
//링크 기본동작은 작동하지 않도록 한다.
e.preventDefault();
$('#mask, .window').hide();
});
//검은 막을 눌렀을 때
$('#mask').click(function () {
$(this).hide();
$('.window').hide();
});
 

위 코드들은 당연히 jQuery(document).ready(function(){ /*코드 넣는 부분*/ }) 으로 감싸 줘야 한다.

완성된 코드는 아래와 같다.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
#mask {
position:absolute;
z-index:9000;
background-color:#000;
display:none;
left:0;
top:0;
}
.window{
display: none;
position:absolute;
left:100px;
top:100px;
z-index:10000;
}
</style>
<script>
function wrapWindowByMask(){
//화면의 높이와 너비를 구한다.
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//마스크의 높이와 너비를 화면 것으로 만들어 전체 화면을 채운다.
$('#mask').css({'width':maskWidth,'height':maskHeight});
//애니메이션 효과 - 일단 1초동안 까맣게 됐다가 80% 불투명도로 간다.
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow",0.8);
//윈도우 같은 거 띄운다.
$('.window').show();
}
$(document).ready(function(){
//검은 막 띄우기
$('.openMask').click(function(e){
e.preventDefault();
wrapWindowByMask();
});
//닫기 버튼을 눌렀을 때
$('.window .close').click(function (e) {
//링크 기본동작은 작동하지 않도록 한다.
e.preventDefault();
$('#mask, .window').hide();
});
//검은 막을 눌렀을 때
$('#mask').click(function () {
$(this).hide();
$('.window').hide();
});
});
</script>
</head>
<body>
<div id="mask"></div>
<div class="window">
<input type="button" href="#" class="close" value="나는야 닫기 버튼(.window .close)"/>
</div>
<a href="#" class="openMask">검은 막 띄우기</a>
</body>
</html>
 



간단한 레이어 팝업

<style type="text/css">
ul.pop_box{position:absolute; background-color:#fff; border:1px solid #333; width:62px; display:none;}
ul.pop_box li{padding:3px;}
</style>

<script type="text/javascript">
jQuery(function($) {
 var $popBox = null;
 $('.friend_list li .user_img').on('click', function(e) {
  if($popBox == null) {
   $popBox = $(
    '<ul class="pop_box">'+
    ' <li>친구끊기</li>'+
    ' <li>서재가기</li>'+
    '</ul>'
   ).appendTo('body');
  }
  
  $popBox.css({left:e.pageX, top:e.pageY}).show();
  e.stopPropagation();
 });
 
 $(document).on('click', function(event) {
  var p = $(event.target).closest('ul.pop_box');
  if(p.size() == 0) {
   $('.pop_box').hide();
  }
 });
});
</script>

<ul class="friend_list">
    <li>
        <img class="user_img" src="" />
    </li>
</ul>

 

+ Recent posts