IEのみに表示変更させるための分岐

IEに対応させるための条件分岐。
こちらを参考に。
http://w3g.jp/blog/tools/js_browser_sniffing
http://twihelp.me/qRdUu
http://www.nk0206.com/life/2009/04/jquery-1.html

(書き直すかも)

		$(function(){
			var _ua = (function(){
				return {
				ltIE6:typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined",
				ltIE7:typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined",
				ltIE8:typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined",
				IE:document.uniqueID,
				Firefox:window.sidebar,
				Opera:window.opera,
				Webkit:!document.uniqueID && !window.opera && !window.sidebar && window.localStorage && typeof window.orientation == "undefined",
				Mobile:typeof window.orientation != "undefined"
				}
			})();
			if(_ua.ltIE6 || _ua.ltIE7 || _ua.ltIE8 || _ua.IE && !_ua.ltIE8){
				$("#divSample").addClass("divSampleIe");
				return false;
			}else{
				return false;
			}
		});

(画像)アップローダー。画面遷移ナシのもの。

画像ローディング画面つき画像アップローダーが作りたくて調べたのでメモ。

Ajax的に画像などのファイルをアップロードする方法
http://havelog.ayumusato.com/develop/javascript/e171-ajax-file-upload.html

シンプルにAjaxファイルアップロードできるjQueryプラグイン
http://d.hatena.ne.jp/lagos_on/20091107/1257610779

Ajax + jQueryで超簡単にファイルをアップロードするためのメモ
http://blog.mudaimemo.com/2009/05/ajaxfileuploadajaxjquery.html

jQueryプラグインまとめ
http://phpspot.org/blog/archives/2010/11/ajaxjquery10.html

使ってみた
http://webdeveloperplus.com/jquery/ajax-multiple-file-upload-form-using-jquery/

iOSとAndroidの表示振り分け

暫定。もっと綺麗に書き換えられる気もする。

<!-- 表示の出し分け --> 
<script type="text/javascript">
$(function(){
	var ua = navigator.userAgent;
	if ((/iPhone/.test(ua) || /iPad/.test(ua)) && (/OS 6/.test(ua) || /OS 7/.test(ua) || /OS 8/.test(ua))) {
		 // iOS6~8向けの処理
	} else {
		if (/Android 4/.test(ua) || /Android 5/.test(ua) || /Android 6/.test(ua)) {
			// Android4~6向けの処理
		} else {
		 // それ以外向けの処理
		}
	}
	return false;
	});
</script>

thisについていろいろ

jQueryのthisの処理がよくわからないので調べている。。。

http://mayoneco.com/blog/2011/01/jquery_parent_child/
http://blog.livedoor.jp/eeu/archives/55307897.html
http://baseviews.com/program/jquery-get-child-elements-of-this.html

イベントハンドラ指定はonとoffを使うといい

□Before
$(‘.trigger’).click(function(){…});
□After
$(‘a.trigger’).on(‘click’, function(){…});
以下にすれば昔の live と同じ挙動になる

$(document).on(‘click’, ‘a.trigger’, function(){…});

 

http://c-brains.jp/blog/wsg/11/11/08-161217.php

http://ginpen.com/2011/11/04/jquery-1-7/#post639-on

http://the-zombis.sakura.ne.jp/wp/?p=1283