mirror of https://github.com/ColorlibHQ/AdminLTE
fix(4514): demo.js cannot read properties of undefined (reading 'classList')
parent
98dbf6ec82
commit
c2d7f21a33
|
@ -525,11 +525,14 @@
|
|||
})
|
||||
|
||||
var active_navbar_color = null
|
||||
$('.main-header')[0].classList.forEach(function (className) {
|
||||
if (navbar_all_colors.indexOf(className) > -1 && active_navbar_color === null) {
|
||||
active_navbar_color = className.replace('navbar-', 'bg-')
|
||||
}
|
||||
})
|
||||
var $main_header = $('.main-header')
|
||||
if ($main_header.length > 0) {
|
||||
$main_header[0].classList.forEach(function (className) {
|
||||
if (navbar_all_colors.indexOf(className) > -1 && active_navbar_color === null) {
|
||||
active_navbar_color = className.replace('navbar-', 'bg-')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$navbar_variants_colors.find('option.' + active_navbar_color).prop('selected', true)
|
||||
$navbar_variants_colors.removeClass().addClass('custom-select mb-3 text-light border-0 ').addClass(active_navbar_color)
|
||||
|
@ -590,12 +593,15 @@
|
|||
$container.append($sidebar_dark_variants)
|
||||
|
||||
var active_sidebar_dark_color = null
|
||||
$('.main-sidebar')[0].classList.forEach(function (className) {
|
||||
var color = className.replace('sidebar-dark-', 'bg-')
|
||||
if (sidebar_colors.indexOf(color) > -1 && active_sidebar_dark_color === null) {
|
||||
active_sidebar_dark_color = color
|
||||
}
|
||||
})
|
||||
var $main_sidebar = $('.main-sidebar')
|
||||
if ($main_sidebar.length > 0) {
|
||||
$main_sidebar[0].classList.forEach(function (className) {
|
||||
var color = className.replace('sidebar-dark-', 'bg-')
|
||||
if (sidebar_colors.indexOf(color) > -1 && active_sidebar_dark_color === null) {
|
||||
active_sidebar_dark_color = color
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$sidebar_dark_variants.find('option.' + active_sidebar_dark_color).prop('selected', true)
|
||||
$sidebar_dark_variants.removeClass().addClass('custom-select mb-3 text-light border-0 ').addClass(active_sidebar_dark_color)
|
||||
|
@ -623,12 +629,14 @@
|
|||
$container.append($sidebar_light_variants)
|
||||
|
||||
var active_sidebar_light_color = null
|
||||
$('.main-sidebar')[0].classList.forEach(function (className) {
|
||||
var color = className.replace('sidebar-light-', 'bg-')
|
||||
if (sidebar_colors.indexOf(color) > -1 && active_sidebar_light_color === null) {
|
||||
active_sidebar_light_color = color
|
||||
}
|
||||
})
|
||||
if ($main_sidebar.length > 0) {
|
||||
$main_sidebar[0].classList.forEach(function (className) {
|
||||
var color = className.replace('sidebar-light-', 'bg-')
|
||||
if (sidebar_colors.indexOf(color) > -1 && active_sidebar_light_color === null) {
|
||||
active_sidebar_light_color = color
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (active_sidebar_light_color !== null) {
|
||||
$sidebar_light_variants.find('option.' + active_sidebar_light_color).prop('selected', true)
|
||||
|
@ -676,11 +684,14 @@
|
|||
$container.append($brand_variants)
|
||||
|
||||
var active_brand_color = null
|
||||
$('.brand-link')[0].classList.forEach(function (className) {
|
||||
if (logo_skins.indexOf(className) > -1 && active_brand_color === null) {
|
||||
active_brand_color = className.replace('navbar-', 'bg-')
|
||||
}
|
||||
})
|
||||
var $brand_link = $('.brand-link')
|
||||
if ($brand_link.length > 0) {
|
||||
$brand_link[0].classList.forEach(function (className) {
|
||||
if (logo_skins.indexOf(className) > -1 && active_brand_color === null) {
|
||||
active_brand_color = className.replace('navbar-', 'bg-')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (active_brand_color) {
|
||||
$brand_variants.find('option.' + active_brand_color).prop('selected', true)
|
||||
|
|
Loading…
Reference in New Issue