This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
画像の高さと幅を更新(Update Image Size) | |
Winコマンド:Ctrl+U | |
Macショートカット:Shift + Ctrl + I |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
$.fn.random = function(){ | |
var index = Math.floor(Math.random() * this.length); | |
return this.eq(index); | |
}; | |
})(jQuery); | |
// $("elem").random() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.clearfix { | |
*zoom: 1; | |
} | |
.clearfix:before, | |
.clearfix:after { | |
content: ""; | |
clear: both; | |
display: table; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* SVG Fixer | |
* | |
* Fixes references to inline SVG elements when the <base> tag is in use. | |
* Firefox won't display SVG icons referenced with | |
* `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page. | |
* | |
* More info: | |
* - http://stackoverflow.com/a/18265336/796152 | |
* - http://www.w3.org/TR/SVG/linking.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MyPhotoswipeInit(pswpElement, PhotoSwipeUI_Default, items, options){ | |
var pswp = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options); | |
pswp.listen('imageLoadComplete', function(index, item) { | |
if ( item._myLoaded ) { | |
return; | |
} | |
var img = document.createElement('img'); | |
img.onload = function(){ | |
item.w = this.naturalWidth; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// window.scrollMaxX, window.scrollMaxY polyfill | |
'scrollMaxX' in window || Object.defineProperties(window, { | |
scrollMaxX: { | |
enumerable: true, | |
get: function(){ | |
return document.documentElement.scrollWidth - document.documentElement.clientWidth; | |
}, | |
}, | |
scrollMaxY: { | |
enumerable: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('change', function(evt){ | |
var elem = evt.target; | |
if ( elem.hasAttribute('data-hansu') ) { | |
elem.value = elem.value.replace(/[0-9]/g, function(s){ | |
return String.fromCharCode(s.charCodeAt(0) - 0xFEE0); | |
}).replace(/\D/g, ''); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
// over 2 mousemove events fired in 300ms | |
var over = 2, period = 300; | |
var count = 0; | |
var timer = null; | |
var mousemove = function(evt){ | |
if ( !timer ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var supportSticky = (function(){ | |
var el = document.createElement('div'); | |
el.style.position = 'sticky'; | |
if (el.style.position === 'sticky') { | |
return true; | |
} | |
el.style.position = '-webkit-sticky'; | |
if (el.style.position === '-webkit-sticky') { | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function supportWebStorage () { | |
if (!window.sessionStorage) { | |
return false; | |
} | |
try { | |
var key = 'supportWebStorage-' + (new Date()).getTime(); | |
window.sessionStorage.setItem(key, 1); | |
window.sessionStorage.removeItem(key); | |
return true; | |
} catch(err) { |
OlderNewer