Skip to content

Instantly share code, notes, and snippets.

View riix's full-sized avatar

Park, Soon-Ghil riix

View GitHub Profile
@riix
riix / Atom
Last active September 23, 2015 03:10
automatic update by http://atom.io/packages/sync-settings
Atom
@riix
riix / defer.js
Created July 23, 2012 04:37
defer.js Skullbone Code
/*
* Defer Function Snipplet
* by Riix
*/
// http://ajaxian.com/archives/no-more-ie6-background-flicker
if (typeof document.body.style.maxHeight == "undefined") {
try {
document.execCommand('BackgroundImageCache', false, true);
} catch(e) { }
@riix
riix / gist:3161989
Created July 23, 2012 04:42
시작페이지, 즐겨찾기 추가 버튼
// 시작페이지 설정
$('#util a[href="#bookmark"]').on('click', function(event){
event.preventDefault();
if($.browser.msie){
window.external.AddFavorite('http://www.epasshakjum.co.kr', '이패스학점 - 평생교육의 실현');
} else {
alert('죄송합니다.\nInternet Explorer 만 지원하는 스크립트입니다.\n브라우저 내장 기능을 사용해주세요.\nFireFox 의 경우 Ctrl+D의 단축키를 제공합니다.');
}
});
@riix
riix / basic.js
Created July 24, 2012 04:50
jQuery 기본
// Switch StyleSheets With jQuery
$('link[media='screen']').attr('href', 'Alternative.css');
// 동적 생성으로 DOM 객체 추가하기
var $newDiv = $('<div></div>');
$newDiv.attr("id","newDiv").appendTo("body");
// 양 객체 사이에 다른 요소 삽입하기
$("p:not(:last-of-type)").after("<br />");
@riix
riix / gist:3168034
Created July 24, 2012 04:21
Iterate over properties of and object
var object = {
a: 10;
b: 20;
s: 'hello'
};
$.each(object, function(name, value){
console.log(name+':'+value);
});
@riix
riix / gist:3168057
Created July 24, 2012 04:32
Keycatch Code with jQuery
$('body').bind('keypress', function(event) {
if( event.keyCode == 13 ){
$('form').eq(0).submit();
}
});
@riix
riix / gist:3168068
Created July 24, 2012 04:36
jQuery Password field disappearing default
<!-- HTML -->
<input id="password-clear" type="text" value="Password" autocomplete="off" />
<input id="password-password" type="password" name="password" value="" autocomplete="off" />
// CSS
#password-clear {
display: none;
}
// JQUERY
@riix
riix / browser.js
Created July 24, 2012 04:56
Brower Detect
var $ap = navigator.appVersion
var $ua = navigator.userAgent.toLowerCase ();
var browser = {
ie : $ap.indexOf('MSIE') != -1,
ie6 : $ap.indexOf('MSIE 6') != -1,
ie7 : $ap.indexOf('MSIE 7') != -1,
ie8 : $ap.indexOf('MSIE 8') != -1,
opera : !!window.opera,
safari : $ua.indexOf('safari') != -1,
safari3 : $ua.indexOf('applewebkit/5') != -1,
@riix
riix / string.ellipsis.js
Created July 24, 2012 05:23
말 줄임 ellipsis
(function($) {
$.fn.strCut = function(settings) {
var config = {
max : 10
};
if (settings) $.extend(config, settings);
this.each(function() {
$(this).css('white-space','nowrap');
if ($(this).text().length > config.max) {
@riix
riix / simpleSticky.js
Created July 24, 2012 06:06
스카이스크래퍼, Sticky Menu
$(window).scroll(function() {
if ($(window).scrollTop() > 175 ) {
$('.sticky').css({'position' : 'fixed', 'top' : 0});
} else {
$('.sticky').css({'position' : 'relative', 'top' : 'none'});
}
});