微件:轮播图:修订间差异
跳转到导航
跳转到搜索
无编辑摘要 |
无编辑摘要 |
||
第20行: | 第20行: | ||
function createSlider(images, links) { | function createSlider(images, links) { | ||
images.forEach((obj, index) => { | images.forEach((obj, index) => { | ||
let a = document.createElement('a'); | |||
a.href = obj.link; | |||
let img = document.createElement('img'); | let img = document.createElement('img'); | ||
img.src = obj.src; | img.src = obj.src; | ||
img.style.opacity = index === 0 ? 1 : 0; | img.style.opacity = index === 0 ? 1 : 0; | ||
a.appendChild(img); | |||
slider.appendChild( | slider.appendChild(a); | ||
let dot = document.createElement('span'); | let dot = document.createElement('span'); |