목록JQuery (10)
FILife
blueimp-fileupload 플러그인이 webpack과 의존성 충돌이 발생하여 이것과 jquery, jquery-ui 등을 별도로 사용했었다. 오랜만에 생각이 나 구글을 다시 뒤져보니 해법이 있었다. 1. script-loader 설치 > npm install --save-dev script-loader 2. 기존 페이지 내의 태그를 제거하고, 해당 플러그인이 사용되는 js에 다음과 같이 import 시킨다. require('script-loader!blueimp-file-upload/js/vendor/jquery.ui.widget.js'); require('script-loader!blueimp-tmpl/js/tmpl.js'); require('script-loader!blueimp-load-im..
미개한 우리 국민들은 여전히 flash를 사용하는 경우가 많다. flash 사용이 꼭 필요한 경우, jQuery의 jqplugin을 통해 간단히 설치 여부를 확인할 수 있다. https://code.google.com/p/jqplugin/ 에서 내려 받아 사용한다. $.browser.flash 와 같이 호출 하면 boolean 형식으로 리턴 된다. 지원 목록은 다음과 같다고 한다.FlashSilverlightPDF(checks if pdf mimetype is supported not limited to one PDF application)JavaQuicktimeWindows Media PlayerShockwaveRealplayer 출처: http://stackoverflow.com/questions/1..
document.body.addEventListener('touchstart', function(e){ e.preventDefault(); });와 같이 하여 document 전체에 대해 이벤트를 막을 수 있음. 특정 객체를 선택하여 이벤트를 막으려는 경우에는 jquery를 사용하여, $("any-object-selector").get(0).addEventListner( 'touchstart', function(e) {e.preventDefault();}); 해제도 필요한 경우에는 function을 따로 정의하여 사용한다. function lock_touch(e) {e.preventDefault();} 설정 : $("any-object-selector").get(0).addEventListner( 'to..
보통 input 또는 textarea 객체에는 keydown, keyup, keypress 이벤트를 사용하는데, 이는 붙여넣기 동작을 인식하지 못한다. 이럴때는 먼저 keydown(또는 keyup, keypress)에 대한 이벤트 핸들러를 만들어 준 후, $("#object").live("input paste", function() {$(this).trigger("keydown");}); 과 같이 처리 해 주면 붙여넣기 할 때에도 잘 동작한다. 출처 : http://stackoverflow.com/questions/686995/jquery-catch-paste-input
발단은 이러함. 24 X 7 정도의 테이블에서 드래그를 통해 다중선택을 구현하려는데, 다시 드래그만 했다 하면 선택이 초기화 됨. 문제 1. 다중선택을 하려면 ctrl 키를 누른채로 드래그 or 클릭해야 함. 문제 2. 선택된 영역을 다시 드래그 해도 선택이 해제되지 않음. 먼저 다중선택 기본옵션은 jquery-ui 코어를 수정함. options: {appendTo: "body", autoRefresh: true, distance: 0, filter: "*", tolerance: "touch"} 의 끝에 하나를 추가해서, options: {appendTo: "body", autoRefresh: true, distance: 0, filter: "*", tolerance: "touch", multiSelec..
var prev_val; $('#dropdown').focus(function() { prev_val = $(this).val(); }).change(function() { $(this).blur() // Firefox fix as suggested by AgDude var success = confirm('Are you sure you want to change the Dropdown?'); if(success) { alert('changed'); // Other changed code would be here... } else { $(this).val(prev_val); alert('unchanged'); return false; } }); 즉, focus() 이벤트에서 현재 선택값을 저장해두고, 취..
와 같이 리턴하는 경우 jQuery.post(또는 get)의 콜백함수에서 data 변수로 리턴 받는다 가정하면, var dt = jQuery.parseJSON(data); 와 같이 해주면 dt는 일반 배열처럼 사용할 수 있게 된다!!! 출처 : http://stackoverflow.com/questions/3250623/php-array-to-js-array-with-jquery-and-json-encode
.post()나 .get() 대신 .ajax()를 사용하여 property에 async:false 를 주는 수도 있지만, 애초에 jQuery의 ajaxSetup 옵션을 변경하여 처리할수도 있다고 한다. You can put the JQuery's AJAX setup in synchronous mode by calling jQuery.ajaxSetup({async:false}); and then perform your ajax calls using jQuery.get( ... ); then just turning it on again once jQuery.ajaxSetup({async:true}); I guess it works out the same thing as suggested by @Adam bu..
ajax(jquery) 무한 스크롤 스크롤 끝에 가면 다음 데이터 로드| PHP 2010/07/06 15:35 Posted by 탱군 wrd-scroll.zip 구조설명: 컨텐츠 페이지 구조 content content 로딩중 이미지 보여주는 부분과 실제 데이터 가져오는 부분 function lastPostFunc() { $('div#lastPostsLoader').html(''); $.post("scroll.asp?action=getLastPosts&lastID=" + $(".wrdLatest:last").attr("id"), function(data){ if (data != "") { $(".wrdLatest:last").after(data); } $('div#lastPostsLoader').empt..