개발일지/JS

jQuery로 작업할 때 가장 많이 쓰던 코드들이다. 1. 공통 header, footer html 파일을 로드2. 제이쿼리 탭 메뉴 소스3. 제이쿼리 아코디언 메뉴 소스4. 제이쿼리 드롭다운 메뉴 소스5. 제이쿼리 커스텀 셀렉트 박스 소스 $(function() { // layout $('#header').load('../../docs/base/header.html'); $('#footer').load('../../docs/base/footer.html'); }); /* Tab */ function tab(e, num){ var num = num || 0; var menu = $(e).children(); var con = $(e+'-con').children(); var select = $(menu)..
마크업에서 단순히 아이템들이 채워져 있는 모습을 보여주기 위해 반복되는 돔을 Ctrl+C/V 해놓는 경우가 많은데, 템플릿으로 분리하고 필요한 갯수만큼만 스크립트로 반복해서 삽입할 수 있도록 했다. HTML JS function cloneChild(target, n){ for(var i=1; i
IssueiOS 하위 버전(10미만)에서 auto copy가 안 되는 이슈가 있어서, 인풋 영역을 터치하면 자동으로 영역을 잡아주는 기능으로 대체했다. 적어도 드래그 하면서 셀렉트 영역을 잡는 수고로움을 덜어주기 위해! 그런데 select()만으로는 iOS 에서 영역이 전체 선택되지 않고, readonly 임에도 불구하고 커서가 나타났다 (키보드 없이). 그래서 찾아보니 setSelectionRange()를 사용하면 된다는 걸 알았다. Syntax inputElement.setSelectionRange(selectionStart, selectionEnd, [optional] selectionDirection); [참고] https://developer.mozilla.org/ko/docs/Web/API/H..
티스토리 기본 단축키 사실 기본 단축키가 있다는 걸 오늘 알았다. 단축키로 's'를 쓰려고 하니까 뭔가 엉키는 것 같아서 찾아보니 기본 제공 단축키가 있었다! Q : 관리자 페이지A : 이전 글 보기S : 다음 글 보기Z : 최근 글 보기X : 최근 댓글 보기C : 최근 트랙백 보기 티스토리 단축키 추가하기 Q, A, S, Z, X, C는 이미 사용 중이니 유의해야 한다. 다른 블로그에는 자바스크립트 버전이 있긴 한데 필요없는 코드도 있는 것 같아, jQuery 버전으로 만들어봤다. /* 단축키 추가하기 */ var shortcut = new Array(); shortcut['w'] = "/admin/entry/post/"; /* 새 글 쓰기 */ $(document).keypress(function(e..
BEFORE range 값을 변경하면 배경 이미지가 transition을 통해 자연스럽게 변하는 형태다. 비주얼이 큰 부분을 차지하는 페이지이다. 아래 스크린 샷에서 볼 수 있듯 처음에는 이미지 1개만 로드되어, 배경이 변경될 때 깜빡이는 현상이 생긴다. 이미지가 처음에 모두 로드되어 있다면 없어질 현상이다. AFTER 방법을 찾아보니 간단한 스크립트를 통해 미리 받아 놓을 수 있었다. JavaScript Method #1 Unobtrusive, gracefully degrading, and easy to implement, simply edit/add the image paths/names as needed — no other editing required: This method is especiall..
See the Pen Band Corona - TopViewCount50 by Hyejin Oh (@zineeworld) on CodePen.
https://developer.mozilla.org/en-US/docs/Web/API/Document/createDocumentFragmenthttp://www.nextree.co.kr/p2081/
http://stackoverflow.com/questions/1807187/how-to-remove-an-element-slowly-with-jqueryhttp://stackoverflow.com/questions/978708/jquery-append-fadein
up vote38down voteacceptedThis will work in every case, no need to put a 'ridiculous' number in it:$(document).scrollTop($(document).height());shareimprove this answeranswered Dec 27 '09 at 19:43Tatu Ulmanen71k19131156 Nice and simple. – gnarf Dec 27 '09 at 19:472 Doesn't work in "every" case. I tried it and it doesn't quite scroll to the bottom. It was fixed by putting a "slightly less ridiculo..
function _help(msg) { var o; switch (typeof(msg)) { case 'undefined': case 'boolean': case 'number': case 'string': o = msg; break; case 'function': o = msg.toString(); break; case 'object': if (msg === null) { o = 'null'; } else if (Array.isArray(msg)) { o = msg; } else { o = JSON.parse(JSON.stringify(msg)); } break; default: console.warn('log.out: undeterminable type: {0}'.format()); o = msg; ..
zineeworld
'개발일지/JS' 카테고리의 글 목록 (2 Page)