//切换图片(动效)backgrounds:数组,select选择器,time时间
function bgAll(backgrounds, select, time) {
var bgCounter = 0,
backgrounds = backgrounds;
function changeBackground() {
bgCounter = bgCounter % backgrounds.length;
$(select).css('background-image', 'url(' + backgrounds[bgCounter] + ')');;
if (bgCounter < backgrounds.length) {
bgCounter++;
setTimeout(changeBackground, time);
}
}
changeBackground();
};
jq切换背景图片
最新推荐文章于 2023-09-22 00:40:32 发布