본문 바로가기

js/jQuery

(28)
[javascript] 모달 사용시 콜백 예제 모달 라이브러리를 사용할 일이 많은데 보통 모달창을 열고 닫거나 확인 할때 함수를 실행해야합니다. 콜백 함수를 open 에 넣어주는데 없을때 간단하게 구현해주는 예제입니다. 1. 모달 js // modal javascript var _data = { a : null , b : null }; _data.isCallbackExists = false; var _callback = {}; //modal open _data.open = function (callback) { $("{{Modal DIV}}").modal(); if (callback) { _data.isCallbackExists = true; _callback.run = function (data) { var runCallback = function..
[jquery] div 스크롤 감지(바닥, 끝) 바닥(?)에 닿으면 함수 실행 $('#{{DIV}}').scroll(function () { if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) { {{실행 함수}} } });
[javascript] guid 만들기 html 생성 css #guid { width:500px; } javascript var _guid = {}; _guid.get = function() { return _guid.s4() + _guid.s4() + _guid.s4() + _guid.s4() + _guid.s4() + _guid.s4() + _guid.s4() + _guid.s4(); } _guid.s4 = function() { return Math.floor((1 + Math.random()) * 0x10000) .toString(16) .substring(1); } $('#btn_create').on('click', function(){ $('#guid').val(_guid.get()); }); demo : jsfiddle link
[jquery mobile] ListView scroll load more https://goo.gl/2c9XYy jsfiddle http://jsfiddle.net/knuTW/2/ lazy load https://goo.gl/7yAsDT jsfillde http://jsfiddle.net/Palestinian/pAgbT/light/ http://embed.plnkr.co/J4IbE9/ https://codepen.io/Palestinian/pen/ApFDG lazy loader plugin https://goo.gl/WMxVZi git https://github.com/dcarrith/jquery.mobile.lazyloader Masonry plugin https://goo.gl/v652YU 6 type jquery-infinite-scrolling-demos with so..
[jquery mobile] swipe event swipe left / right 는 기본적으로 이벤트 핸들러를 제공하는데 up/down 은 api doc 에 없어서 구현 된 예제를 찾아봤습니다. jquery Mobile https://api.jquerymobile.com/swipe/ jsfiddle https://goo.gl/Nwvhu1 touch swipe - 페이지 하단에 example 들이 있습니다. http://labs.rampinteractive.co.uk/touchSwipe/demos/Page_scrolling.html
[jQuery] to find checkbox and change attribute 1234567891011$(".Chk_Choice").click(function () { var parentChildren = $(this).parent().parent().parent().children(); var parentAllChecked = false; var isChecked = $(this).is(":checked"); var checkboxId = $(this).attr("id"); $.each(parentChildren.find("input[type=checkbox]"), function (index, item) { if (checkboxId != $(item).attr("id")) { $(item).attr("disabled", isChecked); } }); });Colored by..
[jquery] 해당 클래스를 제외한 요소 선택 inputGroup 클래스를 가진 input 요소들 중에 rate 클래스를 가지지 않는 요소들에게 mask plugin 을 설정하고 싶다고 가정할때 html 12cs javascript 1 $("input.inputGroup").not(".rate").mask('000,000,000,000,000', { reverse: true });cs
[jquery][plugin] input mask jquery에는 무수히 많은 플러그인들이 있는데요. 웹개발에서 가장 많이 쓰이는 입력 양식이라면 금액 입력일 거 같습니다. 자동으로 3자리마다 "," 찍어주는 마스크 플러그인 중 유연하고 다양한 입력 mask 를 제공하는 플러그인을 찾아봤습니다. home page https://igorescobar.github.io/jQuery-Mask-Plugin/ //간단 예제 //금리 입력 $(".rate").mask('00.00', { reverse: true }); //금액 입력 $("input.inputGroup").mask('000,000,000,000,000', { reverse: true }); 웹소스에는 CDN 으로 간편하게 추가 할 수 있습니다. cdn url : https://cdnjs.cloudf..