$(".menu").ready(function() {
$('.edg_or').hide();
$('.menu').bind('click', function() {
var id = this.id;
$('#' + id + '+ div').toggle()
});
});
var a = []
var b = {}
function clic(e, er) {
let abc = 0
b = {
name: e,
url: er
}
console.log(b);
// a.push(b)
for (let i = 0; i < a.length; i++) {
if (a[i].name == b.name) {
abc++
}
}
if (abc == 0) {
a.push(b)
}
ull()
document.getElementById("wbb").src = er
let kl = document.getElementsByClassName("kl")
console.log(kl);
for (let l = 0; l < kl.length; l++) {
// if(a.length>0){
// document.getElementById("wbb").src=a[i].url
// }
kl[l].onclick = function() {
if (a.length > 0) {
console.log(l);
document.getElementById("wbb").src = a[l].url
}
// location.href = a[l].url
sessionStorage.setItem("qw", JSON.stringify(a))
}
}
console.log(a);
console.log(123);
}
function ull() {
let data = ''
for (let i = 0; i < a.length; i++) {
// onclick="funt(${i})"
data += `<div class="kl" >
<p class="font">${a[i].name}</p>
<img src="img/关闭.png" alt=""onclick="url(${i})">
</div>`
}
$("#mianbao").html(data)
}
// function funt(l){
// let kl = document.getElementsByClassName("kl")
// console.log(kl);
// location.href=a[l].url
// sessionStorage.setItem("qw",JSON.stringify(a))
// }
function url(i) {
a.splice(i, 1)
ull()
if (a.length == 0) {
document.getElementById("wbb").src = shouye.html;
} else {
document.getElementById("wbb").src = a[a.length - 1].url;
}
}