hb_zhgd_screen/js/pages/video/video2.js

43 lines
1.4 KiB
JavaScript

let form, layer;
layui.use(["form", 'layer'], function () {
form = layui.form;
layer = layui.layer;
setMenusData();
if ($('#nav-right ul li').length > 0) {
let hrefValue = $('#nav-right ul li').eq(0).attr('hrefValue');
$('#indexIframe').attr('src', hrefValue);
}
$('#nav-right ul li').on('click', function () {
$('#nav-right ul li').each(function (index, item) {
if ($(this).hasClass('checked')) {
$(this).removeClass('checked').addClass('nocheck');
}
})
$(this).removeClass('nocheck').addClass('checked');
const hrefValue = $(this).attr('hrefValue');
$('#indexIframe').attr('src', hrefValue);
})
});
/* 初始化菜单 */
function setMenusData(data) {
let dataList = [
{
menuName: '固定球机',
url: 'fiexed_video.html'
},
{
menuName: '移动球机',
url: 'move_video.html'
}
];
let html = '';
$.each(dataList, function (index, item) {
if (index === 0) {
html += '<li class="layout checked" hrefValue="' + item.url + '"><p>' + item.menuName + '</p></li>'
} else if (index !== 0) {
html += '<li class="layout nocheck" hrefValue="' + item.url + '"><p>' + item.menuName + '</p></li>'
}
})
$('#nav-right ul').empty().append(html);
}