adaptive-backgrounds.js是一款提取图像的主色并把它应用到它的父元素的背景插件

adaptive-backgrounds.js是一款提取图像的主色并把它应用到它的父元素的背景插件

adaptive-backgrounds.js是一款提取图像的主色并把它应用到它的父元素的背景插件。

第一步

$(document).ready(function(){
   $.adaptiveBackground.run()
});

该脚本会查找image(s)与data-adaptive-background属性

第二步

在html中插入

<img src="/image.jpg" data-adaptive-background='1'>

ok,这样就实现了

在线demo

http://editor.bfw.wiki/Editor/Open.html?projectid=15748222447089740088

立即下载adaptive-backgrounds.js查看所有js插件

网友评论0

程序员在线工具箱