読み書きプログラミング

日常のプログラミングで気づいたことを綴っています

jQuery Mobile

jQuery Mobileは、iOSだとページ遷移の度にresizeイベントが発生します

バージョン1.0.1で確認。

themeをユーザー設定可能にする

ウェブアプリとかですと、ユーザーがテーマを設定できるようにしたかったりします。そんなときのテクニック。 <html> <head> ... </head> <body style="display: none;"> ... <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script> <script type="text/javascript"> // Theme should be determined before mobileinit is invoked. if (localStor…</body></html>

Rails3とjQueryとJQuery Mobileとlink_toのpost

結論から。RailsでjQuery Mobileを使う場合、 application.jsからrequire jqueryを削除。(2012/2/18現在、これはjQuery 1.7.1なので。) "all" %>の前にjquery 1.6.4をロードするようにする。 とするのが筋がいい。根拠は、 jQuery MobileではJQueryは1.6.4が…

pageinit

head部でロードするスクリプトの場合、jQuery Mobileのイベントpageinitはliveメソッドでバインドすること。 bindメソッドだと(bindすべきDOMがまだ読み込まれておらず$での戻り値が空なので)コールされない。pageinitハンドラは$(document).readyよりも先に…