Skip to content
This repository was archived by the owner on Jul 28, 2020. It is now read-only.

$.fn.refreshPng()#1

Open
mach3 wants to merge 2 commits into2no:developfrom
mach3:refreshPng
Open

$.fn.refreshPng()#1
mach3 wants to merge 2 commits into2no:developfrom
mach3:refreshPng

Conversation

@mach3
Copy link

@mach3 mach3 commented Aug 16, 2013

VML化された要素を最新の状態にリフレッシュするインターフェースが欲しいと思い、
試しにDevelopブランチをベースに追加してみました。

経緯ですが、.container > .item のような要素があるとして、
親要素にクラスを与えた時、例えば.container.active 等とすると .item の画像が差し替わるような作り方をしているとします。
.itemfixPng() している場合、親要素のクラス追加では
.item のonpropertychangeが発火しない為か、画像の置換がされません。
それを解決するための、少々強引で泥縄的な実装です。

$(".item").fixPng();
$(".container").addClass("active"); // "active" クラスを設定すると .item の見た目が変化する
$(".item").refreshPng(); // 最新の情報に更新する

refreshPng() は画像置換の他に、
親要素をさかのぼってopacityの最小値を求めてそれに同期するおまけ機能がついています。
引数にtrueを渡すとopacityを更新します。

$(".item").refreshPng(true);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant