隨著圖片而更改背景顏色的 jQuery Plugin...

直接看示範頁面就可以理解了:「jquery.adaptive-backgrounds.js • A jQuery plugin for extracting dominant colors from images and applying it to its parent」。

GitHub 的頁面在「briangonzalez/jquery.adaptive-backgrounds.js」。

如果圖片不在同一個 domain 下,會需要設定 CORS 權限 (Cross Origin Resource Sharing),或是在 img tag 下指定 crossorigin 屬性讓程式可以讀取。

Leave a Reply

Your email address will not be published. Required fields are marked *