8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

material design lite と turbolinks

Last updated at Posted at 2015-07-25
  • 当方、デザイナー。ポートフォリオサイトをRailsで作ってみようといろいろ挑戦中。
  • そこにタイミングよく(?) material design lite が出たので取り込んでみる。
  • で、

困った

  • rails の turbolinks と相性が悪く、mdl-js系が全て初回読み込み時しか効かない。
  • リプル効果とかアニメーションが初回しか効かない。ヘッダの固定も。

分からないなりに調べた

  • turbolinks は window.load とかダメらしい。
  • material.jsの中身を覗くと如何にもな箇所が
material.js
window.addEventListener('load', function() {
  • しかし、その後、特に具体的な解決策には出会えずじまい。
  • でも、

勘で書いてみたら動いた。

  • 上記部分を以下のように書き換えた。
material.js
$(document).ready(function(){
  load();
});

function load() {

最後に

  • とりあえず動いたけど、これが良い回避策かどうかは分からないです。
8
8
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?