$(selector).on('click', function(event) { }); くらいしか使ってこなかったのだけど、調べてみたらもっと便利に使える事を知ったのでメモ。多分on()だけじゃなくone()も同じかな。 イベントにネームスペースを付けられる $(selector).on('click.add-button', function(event) { }); $(selector).on('click.remove-button', function(event) { }); // click.remove-buttonだけ削除される $(selector).off('click.remove-button');
jQueryのイベントハンドリングには、現在 .on(),.off()のみが推奨されて利用されています。 その基本的な使い方はこんなかんじでした。 $(element).on(event, function() { console.log('event fired!'); }); この場合、対象となる$(element)において指定したeventが発火した時に、コールバック関数が呼び出されます。非常に直感的ですね。 ところで、これは以前の.bind()と全く同じです。 .bind()の場合は、指定したずばりその要素に対してのみ、イベントハンドリングを行います。よって、.bind()が呼び出されたその時点で存在しない要素に対しては、たとえセレクタが一致していたとしてもハンドリングが行われません。 このことを利用すれば、イベントハンドリングをしたいまさにその要素にのみ、たとえその後同じセレクタ
JQuery Trigger Event on Show/Hide of Elementby Viral Patel · December 17, 2013 JQuery provides powerful API to manage triggering of events. It provides a way to trigger the event handlers bound to an element without any user interaction via the .trigger() method. The .on() method (previously known as .live()) is a great way to add custom handlers to different browser events. When such events are t
Treegrid jquery plugin デモ:TreeGrid for Bootstrap 3.0.x テーブルを折りたたみ可能なツリー型グリッドに変換できる「TreeGrid」。 Bootstrap3なサイトでも使うことができるようです。マークアップ上はただのテーブルですが、これを階層化して開閉できるUIは便利そうです。 こうしてますますBootstrapが強化されていって作り手としては嬉しい限りですね 関連エントリ Bootstrap3のテーマをWYSIWYGでカスタマイズ可能な「Bootstrap Magic」 BootstrapベースのフラットUI実装フレームワーク「Furatto」 Bootstrapのselectをカッコよくできる「Bootstrap-select」 BootstrapをベースとしたフリーのUIKit「Flat UI」 Bootstrapに270の使えるア
<%= link_to "Delete", delete_post_path(post), :confirm => "Are you sure?", :method=>:delete %> みたいにすると、デフォルトでは JavaScript の confirm で確認され、格好悪いので、$.rails.fire メソッドを上書きして Bootstrap のモーダルを出します。 rails = $.rails _fire = rails.fire modal = null createModal = () -> $("body").append('<div class="modal hide fade" id="confirm-modal"> <div class="modal-header"> <a class="close" data-dismiss="modal">×</
Dependency-free notification library Features Dependency-free UMD Web Push Notifications with Service Worker support Named queue system Has 11 layouts, 5 notification styles, 5+ themes Custom container (inline notifications) Confirm notifications TTL with timeout option Progress bar indicator for timed notifications Supports css animations, animate.css, mojs, bounce.js, velocity and others 2 close
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く