Skip to content

Instantly share code, notes, and snippets.

@gawaooooo
gawaooooo / Cakefile
Last active December 11, 2015 03:38
Cakefile
fs = require 'fs'
{exec, spawn} = require 'child_process'
{parser, uglify} = require 'uglify-js'
files = []
# 該当パスのファイルを取得するやつ
get_file = (path) ->
text = ''
stat = fs.statSync(path)
if stat.isDirectory()
@gawaooooo
gawaooooo / imagepreload.js
Created August 3, 2012 05:58
【jQuery】image preload
// 画像の先読み
var imageList = ['top/a.png', 'top/b.png', 'top/c.png'],l = imageList.length, i = 0;
for(; i < l; i++) {
$('<img/>')[0].src = imageList[i];
}
@gawaooooo
gawaooooo / backgroundImage.js
Created July 23, 2012 03:17
【jQuery】background image を変更する
// 設定されたbackground-imageのurlを無効にする場合
$('#hoge').css('background-image', 'none');
// background-imageのurlを変更する場合
$('#hoge').css('background-image', 'url(test.png)');
@gawaooooo
gawaooooo / test.html
Created July 11, 2012 11:55
【jQuery】wrapInner:各要素の子要素を、HTMLで作成した要素で囲む
var elm = $('div.hoge');
elm
.find('span.count').remove()
.end()
.css({'z-index': 100,
'position': 'absolute',
'left': '10px',
'top': '20px'
})
.find('img')
@gawaooooo
gawaooooo / gist:3089082
Created July 11, 2012 08:45
【jQuery】IE7でjQueryのattrが効かない
// jQueryで以下のコードを実行したら、IE7だけ効かなかった
$(ui.helper)
.find('img')
.attr({'width': '100px', 'height': '100px'})
.end()
.find('span.count').remove();
// IE7はimgのwidth, heightが変わらない
// attr->cssに変更したら解決