Skip to content

Instantly share code, notes, and snippets.

@RyoSugimoto
RyoSugimoto / is_jquery.js
Created September 2, 2014 05:44
jQueryオブジェクトかどうかを判定する関数。
function isJquery (obj) {
if(obj instanceof jQuery){
return true;
} else {
return false;
}
}
@RyoSugimoto
RyoSugimoto / seo.html
Created September 3, 2014 01:11
検索エンジンに関わるタグ。
<meta name="robots" content="noindex">
@RyoSugimoto
RyoSugimoto / transitionend.js
Created September 7, 2014 15:44
CSS Transitionのアニメーション終了時に発行するイベント。
var transitionEnds = [
'webkitTransitionEnd',
'oTransitionEnd',
'otransitionend',
'transitionend'
];
$('.elm').on(transitionEnds.join(' '), function (e) {
//
});
@RyoSugimoto
RyoSugimoto / share_buttons.html
Created September 21, 2014 03:55
SNSなどのシェアやフォローのボタン。
<!-- Twitter -->
<a href="http://twitter.com/share?url=共有したいURL&text=ツイート内に含める文字&via=ツイート内に含まれるユーザー名&related=関連アカウント">ツイート</a>
<!-- Facebook -->
<a href="http://www.facebook.com/share.php?u=共有したいURL" onclick="window.open(this.href, 'FBwindow', 'width=650, height=450, menubar=no, toolbar=no, scrollbars=yes'); return false;">シェア</a>
<!-- Google+ -->
<a href="https://plus.google.com/share?url=共有したいURL" onclick="window.open(this.href, 'Gwindow', 'width=650, height=450, menubar=no, toolbar=no, scrollbars=yes'); return false;">Google Plus</a>
<!-- はてなブックマーク -->
@RyoSugimoto
RyoSugimoto / share_buttons_wp.php
Last active June 5, 2017 12:50
SNSなどのシェアやフォローのボタンをWordPressで設置する場合。
<a class="twitter" href="http://twitter.com/intent/tweet?text=<?php
echo trim(wp_title( '', false));
?>&nbsp;|&nbsp;&amp;url=<?php
echo get_permalink();
?>" onclick="window.open(encodeURI(decodeURI(this.href)), 'tweetwindow', 'width=550, height=450, personalbar=0, toolbar=0, scrollbars=1, resizable=1' ); return false;" target="_blank">ツイート</a>
<a class="facebook" href="http://www.facebook.com/share.php?u=<?php
echo home_url();
?>" onclick="window.open(this.href, 'window', 'width=550, height=450,personalbar=0,toolbar=0,scrollbars=1,resizable=1'); return false;">Facebookでシェア</a>
@RyoSugimoto
RyoSugimoto / functions.php
Last active August 29, 2015 14:07
WorsPressでJavaScriptやCSSを読み込む方法のまとめ。「functions.php」で一元管理する。 (http://notnil-creative.com/blog/archives/1299
/**
* スクリプトとスタイルをキューに入れる
*/
function my_scripts() {
// 管理画面では読み込まない
if ( !is_admin() ) {
// スタイルシートディレクトリーを取得する。この方法だと子テーマでもそのまま使える
$dir = get_stylesheet_directory_uri();
@RyoSugimoto
RyoSugimoto / rAF.js
Last active August 29, 2015 14:07 — forked from paulirish/rAF.js
requestAnimationFrameのポリフィル。 (https://gist.github.com/paulirish/1579671
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@RyoSugimoto
RyoSugimoto / get_max.js
Created October 7, 2014 09:35
配列に格納されている数値の最大値(最小値)を返す。
function getMax (array) {
return Math.max.apply(null, array);
}
@RyoSugimoto
RyoSugimoto / load_another_ver_of_jq_01.html
Last active August 29, 2015 14:07
異なるバージョンのjQueryを共存させる方法。
<script src="../../common/js/jquery-2.1.1.js"></script>
<script>
// 新しいバージョンのjQueryを変数に格納
var $2_1_1 = $.noConflict();
</script>
<script src="../../common/js/jquery-1.11.1.js"></script>
<script>
alert($2_1_1.fn.jquery); // 2.1.1
alert($.fn.jquery); // 1.11.1
</script>
@RyoSugimoto
RyoSugimoto / get_ver_of_the_jq.js
Created October 8, 2014 01:53
使用しているjQueryのバージョンを取得する。
alert($.fn.jquery);