yuheijotaki.com

2014/02/10 : 
jQuery スニペット的な

スニペット的な
調べないでサクッと進みたい

//
$(function(){
});

//
$(window).load(function() {
});

//
$(window).on('load resize', function(){
});

//
hoge();
function hoge() {
}

//
$('.hoge').each(function(){
});

// 秒間隔
setInterval(function(){
},1000);

// 秒後
setTimeout(function(){
},1000);

//
var windowWidth = $(window).width();
var windowHeight = $(window).height();
var hogeWidth = $('.hoge').css('width');

// css
$('.hoge').css({'width':'1000px'});
// important
$('.hoge').css({'cssText': 'width: 1000px !important;'});
// 2の倍数
$('.hoge:nth-child(2n)');
// 何番目(0~)
$('.hoge').eq(0);

// リンク拡大
$('.hoge').click(function(){
	window.location=$(this).find('a').attr('href');
	return false;
});
$('.hoge').hover(function(){
	$(this).css({'cursor':'poniter'});
},function(){
	$(this).css({'cursor':'default'});
});

// ストップウォッチ
stopWatch();
function stopWatch() {
	var startTime =  (new Date()).getTime();
	setInterval( function(){
		$(".watch").text(((new Date()).getTime()-startTime)/1000).toFixed(2);
	}, 100);
	$('body').append("<p class='watch'></p>");
	$('.watch').css({'position':'absolute', 'top':'0', 'left':'0', 'color':'#000', 'background':'#fff'});
}