対象者 click()とon('click', function())の違いが分からない人。 click()しか使ったことのない人。 何も考えずにon('click', function())を使っている人。 onの有用性 クリックイベントを書くとき
Redirecting… Click here if you are not redirected.
当ブログの今年の目標は、ずばり「UIの強化」としています。そのためにもJavaScriptやjQueryの習得は必須条件となりますから、このブログを通して、いろいろ試していければよいなと思っています。今回は、タイトルの通り、「スクロールの途中で任意の要素の位置を固定/解除する機能」を試すことにしました。指定した要素が画面上のある位置までスクロールされると動きが止まるといった機能です。実装方法を紹介します。 まず最初に今回の投稿の記事部分の上と下に「#top-bar」、「#bottom-bar」という2つのバーが設置されているのがわかると思います。 「#top-bar」と「#bottom-bar」の2つのバー「#top-bar」は、「ヘッダーバー」の下まで画面がスクロールされると、その場所で位置が固定され、動かなくなります。 「#bottom-bar」は、逆に最初の表示では「フッターバー」の
はじめに 数あるHTML5の機能の中でも、特にビジュアルでインパクトのあるWebGL。GPUを駆使した高速3DCGレンダリングが可能なことで話題になったものの、今一つ普及しない背景には「実装があまりにも難しい」ことがあるのではないでしょうか。 three.jsの登場により、実装のハードルはだいぶ下がりました。しかし、JavaScriptに精通したプログラマでなければ使いこなすのは容易ではなく、ビジュアル要素の強いWebGLにあってデザイナーさんの参入は難しいのが現状です。 今回紹介する「jThree(ジェイスリー)」は、そんなWebGLをjQueryの記法で扱えるようにするための国産JavaScriptライブラリです。前述のthree.jsをラップしてjQueryで操作できるよう設計されており、jQueryを使ったことのある方なら、手軽にWebGLコンテンツを作ることができます。 本記事で
作成:2013/07/1 更新:2014/11/01 Web制作 > 先日ECサイトを制作したときに、動きのあるサイトにしないといけなかったので、色々調べて組み込んでみたんですが、jQueryでもう何でも出来ちゃいますね。近い将来ローカルで画像なんかを編集しなくても、ブラウザだけで色々できるようになるんじゃないでしょうか。今回は定番からちょっとマイナー(Google Analytics関係とか)なものまでjQueryの小技、プラグインを集めさせていただきました。 エンジニア速報は Twitter の@commteで配信しています。 もくじ スクロール 1.ページ内リンク/フッターまわり/トップに戻る 2.パララックス スライド 3.カルーセル 4.レスポンシブなスライダー 5.ヌルヌルサクサクなスライドメニュー 6.サムネイル付きクロスフェードスライドショー 補助 7.Google Ana
必要ならどうぞ。 デモ jQueryでフォームの値を取得する方法をまとめ – jsdo.it – Share JavaScript, HTML5 and CSS jQueryでフォームの値を取得する方法をまとめ – jsdo.it – share JavaScript, HTML5 and CSS 共通:要素の探し方 input要素なんかにid振っちゃうのが一番なんだけど、属性セレクターを使うと楽な場合があります。つまり[name=xxx]で検索するやり方。 <form id="my-form"> <input type="text" name="my-text" value="This is text." /> </form>
2011年04月30日 03:45 引き続きv1.7.2を検証していた際、IE6~IE8でメモリがうまく開放されないケースがあったため、 対策版としてv1.7.3をリリースしました。 ご迷惑をおかけしますが、最新版へのアップデートをお願いします。 2011年04月30日 00:15 jQuery.socialbuttonのXSS脆弱性につきまして、対応版のv1.7.2をリリースしました。 v1.7.2以前のバージョンでは、urlオプションを指定せずに以下のボタンを呼び出した際、無害化されていない document.URLを参照することが原因で、XSS脆弱性が発生します。 mixi いいね facebook いいね GREE いいね 新はてなブックマーク 旧はてなブックマーク ご迷惑をおかけしますが、最新版へのアップデートをお願いします。 2011年04月29日 02:40 現在、jQuer
Google Maps Pop Easyの使い方 使い方は非常にシンプルです。 Step 1: 外部ファイル スクリプトを</body>の上あたりに、外部ファイルとして記述します。 <script type='text/javascript' src='js/jquery.modal.js'></script> <script type='text/javascript' src='js/site.js'></script> Step 2: HTML 最低限必要なHTMLの構造は、こんな感じです。 L.1がトリガー、L.2がオーバーレイ用の空div、L3-6がモーダル内のコンテンツです。 <a class="modalLink" href="#">Click Me</a> <div class="overlay"></div> <div class="modal"> <a href="#"
目次 jQuery 1.4以前の書き方jQuery 1.5以上の書き方jQuery 1.8以上の書き方【発展編1】Deferredを用いた書き方 deferredとは何か?【発展編2】$.when() を用いた書き方参考本エントリは軽めのjQuery Advent Calendar 2012の14日目の記事として書きます。軽めといいながら少し重めになってしまった感がありますが、初めてのAdvent Calendar参加ということでご勘弁を。 ※ Twitter API仕様変更によりTwitter APIを使ったコード例は現在動作しなくなっていることにご注意。 jQuery 1.4以前の書き方まずは、少し古めのコード、昔のjQueryの本とかでよく見る書き方。 $.ajax({ url: "ajax.html", success: function(data) { alert('succes
jQuery.ajax を使ってGETでリソースにアクセスした場合、IEでは2回目以降のリクエストが実際には発行されずにキャッシュされた結果が使われてしまいます。これを防ぐには $.ajax( { url : "http://example.com/", cache : false, data : { a : "abcd" }, ... } ); のように、cache オプションに false を指定すればいいようにドキュメント(http://docs.jquery.com/Ajax/jQuery.ajax#toptions)に書かれています。実際に cache : false を設定してみると、リクエストの発行される URL は、 http://example.com/?a=abcd&_=1253861397368 のようにクエリの末尾に現在時刻のミリ秒が付加されたものになります。 たい
外部サイトのJSファイルを読み込むときに、こういう書き方するのはやめましょう。 <script src="http://example.com/js/jquery.js"></script> 理由 あなたのサイトが、いつの日かSSLに対応することになったとき、そのscriptタグがバグの原因になります。 ご覧のとおり、HTTPSページの中でHTTP要素を読み込もうとすると、ブラウザによっては安全装置が働いて読み込んでくれないのです。 上の例ではjQueryの読み込みに失敗していますが、エラーメッセージ「Uncaught ReferenceError: jQuery is not defined 」を見てもHTTPS/HTTPのプロトコルが原因だとはすぐ気づかないので、わかりにくいバグになってしまいます。 結論 JSファイル(とかCSSとか画像とか)を読み込むときは、"http:"の部分を省
Brandon Aaronの2009.6.24のエントリ Understanding the Context in jQuery jQuery1.3時代に書かれた内容だが賞味期限は切れていない Selectors API(ex.$("a"))などで検索範囲を絞り込むために使う第二引数("Context")の誤用が多い 正しく理解しないと、パフォーマンスアップというご利益は得られないとレクチャー コメント欄では、高速なセレクターの使い方がtest方法付きでレクチャー $("#main","#top");//この書き方は、contextを指定(変更)できていない。 以下斜め読んだ内容 context jQueryで要素指定するときのオプションとして提供。 これ使うと、要素の検索範囲を制限できる ex. div#naviの中のa要素だけを取得 contextはDOMツリーが巨大なページのときは威
リッチなWebアプリケーションに対するニーズの増加に伴い、JavaScriptで十分なパフォーマンスを担保することが難しくなってきています。とりわけ、スマートフォンのような非力なデバイスでは一層シビアなチューニングが求められるでしょう。本セッションでは、もっともポピュラーなJavaScriptライブラリである「jQuery」を中心とした、いくつかのパフォーマンス解決のためのヒントについてご紹介させていただきます。 http://frontrend.github.com/events/04/#pocotan001Read less
注意※Twitterのツイート数の取得のコードについて この記事のコードでは後日、ツイート数の取得ができなくなるとご指摘いただきました。確認したところ2013年5月7日に行われるTwitterの仕様変更によりツイート数の取得ができなくなってしまいます。(それについての記事)その他はてブ、いいね数のコードにつきましては正常に動作します。問題のコードはサンプルとして残しておきますが、ご利用の際はくれぐれもご注意ください。今回の件についてご指摘くださった方々に御礼申しあげます。そして、すべてのユーザーの方々に不確かな情報を提供してしまったことをお詫び申しあげます。 さらに追記※Twitter APIの仕様変更について Twitter APIの仕様変更後もこのコードで動作し続けています。もともとAPIのリファレンスにも載っていませんしいつ仕様が変更されるかわかりません。ご利用の際はくれぐれも気をつ
これもわかりやすかったので、検索用にメモ 参考URL http://blog.mj-site.net/2007/06/jquery-select%E3%81%A7%E6%8C%87%E5%AE%9A%E3%81%AE%E3%82%82%E3%81%AE%E3%82%92%E9%81%B8%E6%8A%9E%E3%81%95%E3%82%8C%E3%81%9F%E7%8A%B6%E6%85%8B%E3%81%AB.html html <select name="pref" id="pref"> <option value="">---------</option> <option value="1">1 : hoge1</option> <option value="2">2 : hoge2</option> <option value="3">3 : hoge3</option> </se
使用にあたっての注意 再配布はご遠慮くださいませ 改変は自由にしてくださって構いませんが、最上部にあるコメント部分は削除しないでください。 このスクリプトを使用し、何らかの問題が発生しても一切責任は負いません。 使用に関しては自己責任でお願いいたします。 ご要望、バグなどございましたらお問合せフォームまで 設置方法1 head要素内にjquery.js、jquery.twitter.jsの順に読み込みます。 <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery.twitter.js"></script> HTMLテンプレート例 下記のように出力されますのでCSSでそれぞれデザインしてください。 既にclass名が重複している場合は、下記「設定可能
MVCフレームワークのBackbone.jsが正式版1.0に到達。jQuery互換のモバイル向け「Zepto」も1.0に JavaScriptのMVCフレームワークとして、おそらくもっとも知名度が高いと思われるBackbone.jsが、ついに正式版となるバージョン1.0としてリリースされました。 Backbone.jsは、わずか1500行程度のとても軽いフレームワークなのが最大の特徴です。昨年末には翻訳コミュニティのenja-ossによってコメントをすべて日本語訳したソースコードが公開されています。 MVCを実現するのにフォーカスしたフレームワークのため、jQueryやテンプレートエンジンのHandlebarsと組み合わせて使うのが一般的です。 バージョン1.0をリリースし、今後のBackbone.jsはどうなっていくのでしょうか? ドキュメントには次のように書いてあります。 In an
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く