목록내가 자꾸 까먹어서 쓰는 개발 이야기/jQuery (19)
FILife
미개한 우리 국민들은 여전히 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..
jQuery 에서는 CSS 셀렉터 와 엘리먼트를 선택해 처리하는 방법을 사용합니다. 그러나 이런 CSS 셀렉터 사용법을 좀더 잘 사용하면 처리속도의 향상을 가져옵니다. 여기에서 jQuery의 내부 처리와 같은 코드를 보고, jQuery를 빠르게 사용하기 위한 TIP 5 를 소개하고자 합니다. 1. 여러번 같은 실렉터를 실행하지 않는다. 2. 클래스만으로 지정하는 것을 금지한다. 3. #id 의 사용을 적극 권장한다. 4. 도중까지 결과를 재이용 한다. 5. 자식 셀렉터(>)를 잘 사용하면 처리가 빨라진다. 1. 여러번 같은 실렉터를 실행하지 않는다. ㅁ 개선전 // 예제1 $("div.foo").addClass("bar"); $("div.foo").css("background","#ffffff"); $(..
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..
jQuery.event.special.dblclick = { setup: function(data, namespaces) { var elem = this, $elem = jQuery(elem); $elem.bind('touchend.dblclick', jQuery.event.special.dblclick.handler); }, teardown: function(namespaces) { var elem = this, $elem = jQuery(elem); $elem.unbind('touchend.dblclick'); }, handler: function(event) { var elem = event.target, $elem = jQuery(elem), lastTouch = $elem.data('lastTo..
한국제이쿼리사이트 : http://www.jquerykorea.net/ jQuerySerial Scroll각종 슬라이딩위치 다양부드러움아이템 랜덤으로 섞기mb.jQuery.components!메뉴다중 카테고리멀티플 메뉴이미지 포함메뉴가 나타나고 사라질 때 부드러운 페이드인 페이드아웃 효과콘테이너자유로운 이동, 마치 윈도우즈 프로그램 창을 다루는 느낌)부드러운 효과이미지 갤러리DOM, 팝업, 이미지 나열이미지 로등시 부러운 효과미디어 임베더치환자를 사용하여 아주 간단하게 코딩미디어 임베더 2백그라운드, DOM에 유트브 등의 무비 넣을 수 있음마스크 이미지 갤러리프레임을 이용한 이미지 갤러리탭부드러운 효과손쉽게 탭 삽입 가능이미지 네비게이터프레임을 이용해서 마스크를 씌운 듯 이미지 일부 노출마우스 드래그로 ..
보통 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() 이벤트에서 현재 선택값을 저장해두고, 취..
.css_example { border: 10px solid blue; border-radius: 10px; margin: 10px; box-shadow: 0 0 25px blue; } 출처 : http://stackoverflow.com/questions/11539164/how-to-change-border-color-of-colorbox
Description:The jQuery.ajaxSetup( options ) method sets global settings for future AJAX requests.Syntax:Here is the simple syntax to use this method:$.ajaxSetup( options ) Parameters:Here is the description of all the parameters used by this method:options: A set of key/value pairs that configure the Ajax request. All options are optional.Here is the list of option which could be used as key/val..
와 같이 리턴하는 경우 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..
jQuery로 선택된 값 읽기 $("#selectBox option:selected").val(); $("select[name=name]").val(); jQuery로 선택된 내용 읽기 $("#selectBox option:selected").text(); 선택된 위치 var index = $("#test option").index($("#test option:selected")); ------------------------------------------------------------------- // Add options to the end of a select $("#selectBox").append("Apples"); $("#selectBox").append("After Apples"); //..
1. ajax !! $.ajax({ type : "POST", url : "action URL", dataType:"json", // json 혹은 xml ,text 로 받을수 있당 error:function(xhr,textStatus){ alert('error!'); }, success:function(text){ alert('success'); // text 이름으로 받는당~~ }, beforeSend:function(){ alert('action 보내기 전에 수행 할수 있당~~~'); } }); 2. css 에 따라서 조건문 달기~~ if($('.css').css('display') == 'none'){ //css 가 none 가 아닐 경우에 이 것이 수행 된다~ } 3. jquery 로 HTML ..
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..
여기에 출력
JQuery 사용해보기. 프로토타입, 도조 등 많은 비슷한 스크립트 라이브러리들이 있지만 요세 대세? 가벼우면서 막강한 JQuery를 사용해보자. 각 포털사이트에서 JQuery를 검색해보면 JQuery는 홈페이지에서 다운로드 할 수 있다. 해당 엘리먼트 접근하기 일반 : document.getElementById("id"); JQuery : $("#id"); - 엘리먼트의 ID 접근시 #, class 접근시 . 해당 엘리먼트의 값 접근하기 일반 : document.getElementById("id").value; JQuery : $("#id").val(); - 엘리먼트의 값을 대입하고 싶다면 $("#id").val("값"); 해당 엘리먼트의 개체를 비교하여 true/false를 알려주는 메소드 일반 : ..
처음으로 jquery를 공부하게 되었다. 인터넷을 뒤적거려보아도 쓸만한 자료가없어서 친구(고마워기욱아)가 개설해놓은 카페에 들어가서 자료를 보았다. 우선 기본적으로 객체접근을 할려면 여러가지 다양한 방법이있다. prototype을 해본사람은 조금 익숙한 접근방법이다. $("") 형식으로 객체를 가져오는데 방법이 많이있다. 각각의 상황에 맞는 방법을 찾아서 사용하면 되겠다. * => 모든 엘리먼트 A:has(B) => 태그명이 B인 자식을 하나이상 가지는 태그명이 A인 모든 엘리먼트 A1 => A1(태그명)인 모든 엘리먼트 A1.class => A1(태그명) 엘리먼트의 클래스가 class와 동일한 엘리먼트 A1.#id => A1(태그명) 요소의 id 속성값이 id와 동일한 엘리먼트 A1 B1 => A1 엘..