Skip to content

Instantly share code, notes, and snippets.

View thirdj's full-sized avatar

Choi, Jaehee thirdj

View GitHub Profile
@thirdj
thirdj / leftBarHeight.css
Created August 16, 2013 08:51
css로 높이 100% 주기 From http://jsbin.com/uqarar/1/edita
html, body { margin: 0; padding: 0;}
#leftBar {
position: fixed;
top: 0;
left: 0;
bottom: 0;
color: red;
opacity: .50;
background-color: #000;
width: 100%;
@thirdj
thirdj / accordion.html
Created August 16, 2013 05:28
jquery accordion
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<style>
dl {}
dd { margin: 0; padding: 0.5em 0; padding-left: 10px; }
dt {
@thirdj
thirdj / closeBrowsers.js
Created August 16, 2013 03:22
브라우저 현재 작업창 닫기
$(function(){
$('#window-btn').click(function(){
if ( $.browser.msie ) {
window.opener='Self';
window.open('','_parent','');
window.close();
} else {
window.close(); // 일반적인 현재 창 닫기
window.open('about:blank','_self').self.close(); // IE에서 묻지 않고 창 닫기
}
@thirdj
thirdj / exist.js
Created August 7, 2013 02:26
$.fn.exist
$.fn.exist = function(){
return this.length > 0;
};
@thirdj
thirdj / multiline_string.js
Created June 17, 2013 01:35
Multi-line strings in JavaScript
// 1.
var lines = [
'<!DOCTYPE html>',
'<html>',
'<body>',
'<h1>Hello, world!</h1>',
'</body>',
'</html>'
].join('\n');
@thirdj
thirdj / keyMouseBlock.js
Created April 17, 2013 02:14
keyboard, mouse block
!function mouseKeyboardBlock() {
document.oncontextmenu = new Function('return false');
document.onselectstart = new Function('return false');
document.ondragstart = new Function('return false');
document.ondragenter = new Function('return false');
document.ondragover = new Function('return false');
document.ondrop = new Function('return false');
document.onkeydown = new Function('return false');
}();
@thirdj
thirdj / onkeyEvent.js
Created April 12, 2013 02:02
onkey events
/*
onkeydown - 모든 키를 눌렀을때(shift, alt, control, capslock 등의 키도 모두 인식한다. 단 한영변환,한자 등의 특수키는 인식못함.)
onkeyup - 모든 키를 눌렀다 땠을때(onkeydown 에서 인식하는 키들을 인식)
onkeypress - 실제로 글자가 써질때 (shift, enter 같은 키는 인식하지 못한다)
*/
document.getElementById('id').onkeyup=function(e){
var event = e || window.event;
console.log('event '+ event);
};
@thirdj
thirdj / timeout.js
Created April 12, 2013 02:01
time method
setTimeout(); // 일정 시간 후에 함수를 한 번 실행
setInterval(); // 일정 시간마다 함수를 반복 실행
clearTimeout(); // 일정 시간 후에 함수를 한 번 실행하는 것을 중지
clearInterval(); // 일정 시간마다 함수를 반복하는 것을 중지
/*
Eaxmple
**/
window.onload = function(){
// 윈도우가 로드될 때
@thirdj
thirdj / arrSorting.js
Created April 12, 2013 00:31
Array number sorting
var points = [40,100,1,5,25,10];
points.sort(function(a,b){return a-b});
console.log(points); // 1,5,10,25,40,100
@thirdj
thirdj / imagecache.js
Created April 11, 2013 05:55
IE6 Images Blank bug Fix script
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}