2014-07-01から1ヶ月間の記事一覧

* jshintでignoreするにはソースコード内に /* jshint ignore:start */ /* jshint ignore:end */ を書くと良い

良いWebfont

游ゴシック体

class名に数字開始文字は使えない chromeやfirefoxでbuttonクリック後のborderを消す方法 :focus {outline:none;} ::-moz-focus-inner {border:0;} currentTargetとtargetの違い http://uhyohyo.net/javascript/3_5.html 実は、currentTargetは、そのイベン…

* jquery height() の代替 > clientHeight* findは親要素からquerySelectorやればとれる

firefoxではinnerTextが使えないため textContentを使う必要がある if( typeof element.textContent != 'undefined' ){// textContent } else{// innerText }

true判定 * firefoxでは、 value === true だとfalse判定を返す場合があるため、 == で判定する方法が無難

スマホ用コンテンツをuaごとに振り分けるためには、 デフォルトで要素をdisplay: none; にしておいて、 あとからblockに書き換えるのが良い。 最初display: blockにしておいて あとから display: none; にすると 一瞬コンテンツが見えてしまう場合がある。

jqueryを使わずnative jsで書く方法一覧 http://blog.romanliutikov.com/post/63383858003/how-to-forget-about-jquery-and-start-using-native

getElementsByClassNameを foreachで回すには http://stackoverflow.com/questions/3871547/js-iterating-over-result-of-getelementsbyclassname-using-array-foreach

querySelectorの使い方 http://webintersect.com/articles/72/add-event-listener-to-dynamic-elements

* chromeのリモートデバッグhttp://iti.hatenablog.jp/entry/2013/11/05/182133 * vimで複数ファイルを一気に置換http://zx.jpn.org/b/20081025/155/vim/vim-mluti-file-replace

* SSHでのファイル転送 https://www.google.co.jp/search?q=ssh+%E3%82%A2%E3%83%83%E3%83%97%E3%83%AD%E3%83%BC%E3%83%89&oq=ssh+%E3%82%A2%E3%83%83%E3%83%97%E3%83%AD%E3%83%BC%E3%83%89&aqs=chrome..69i57j0l5.3396j0j4&sourceid=chrome&es_sm=91&ie=UTF…

var testArray = [3, 8, 13, true, 'あいうえお', 8, 10]; window.alert(testArray.indexOf(8)); // 1がアラートされる window.alert(testArray.indexOf('あいうえお')); // 4がアラートされる

配色 http://www.webcreatorbox.com/inspiration/colour-scheme-ideas-100/

* vimで直前の動作を繰り返すには、.

* user Agent よく使うのでメモ var _agent = navigator.userAgent.toLowerCase(); ns.isAndroid = false; if( !( _agent.match('iphone') || _agent.match('ipod') || _agent.match('android') ) ){ $('body').addClass('pc'); } else if( _agent.match('an…

アプリリンクの貼り方 * iPhoneは、pc,sp共通 例: a(href="https://itunes.apple.com/jp/app/google-jian-suo/id284815942?mt=8&uo=4" target="itunes_store") * androidはidは同一だが、pcとspで切り分け 例: PC: https://play.google.com/store/apps/detai…

* youtubeのcallbackはglobalに置こう I have the answer, separate out this portion of the script and put it in the head in its own script tag. OMG, finally <scripttype="text/javascript"language="javascript">function onYouTubePlayerReady(playerid){ ytp = document.getElementById('ytplayer'); y</scripttype="text/javascript"language="javascript">…

* media queryにはpxを明記しないと動作しない

* npm errorはキャッシュを疑えhttp://codedehitokoto.blogspot.jp/2012/03/towerjsnpm-err.html * もしくはnodeのversion

文章を縦の中央に配置するには、divの中にpを置いて、 div{ p{ width: 280px; margin: 30px auto; text-align: center; }} みたいにするのが良いね。2行になるとその行分、高さが増えるのが難点。

* jsではpostを受け取ることはできない* urlをgetするときはhttp://を抜かしてURIComponentしよう* windowをjsで閉じるには $('.closePage').on('click', function(){ open(location, '_self').close(); });

jadeでfacebookコード等をコピペする方法

div#facebook. <div id="fb-root"></div> <script> (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/ja_JP/all.js#xfbml=1"; fjs.parentNode.insertBefore(js…

facebook callback http://stackoverflow.com/questions/4980061/twitter-and-facebook-share-with-callbacks http://liginc.co.jp/web/service/facebook/35972 http://facebook-docs.oklahome.net/archives/52070227.html twitter callback http://d.hatena…

spriteでバックグランドを変えるときはclass名を付与したり消したりすれば良い > と思ったけど画像が一瞬消えるのでNG facebook OGPはhtml safeOK twitter Cardは多分NG

* compassでtransformを複数書く方法 @include transform(translateY(-100%) scale(0.5)); http://stackoverflow.com/questions/17152920/multiple-transforms-using-compass

androidはposition: fixedのleft: 0を明示的に記述しないとダメ SPモーダルスクロール / http://webdev.jp.net/overflow-scrolling/ clickイベントのtargetプロパティを見れば、押した場所の一番上のレイヤーを取得できる。 (押した場所が親要素なのか子要素…

* setTimeoutはその前にreturnがあろうとも実行されるので注意