Page
<div class="nk-sidebar-element"><div class="nk-sidebar-body"><div class="nk-sidebar-content" data-simplebar><div class="nk-sidebar-menu"></div></div></div>
</div>
loadHTML
var loadHTML = function(container, url) {fetch(url).then(response => {if (!response.ok) {throw new Error('Network error!');}return response.text();}).then(html => {container.html(html);});
};$(function() {try {loadHTML($('.nk-sidebar-menu'), '/menu.html');} catch(e) {console.dir(e);}
});
Menu
<ul class="nk-menu apps-menu"><li class="nk-menu-item"><a href="/dictionary.html" class="nk-menu-link nk-menu-switch" data-target="navDashboards"><span class="nk-menu-icon"><em class="icon ni ni-view-list-fill"></em></span></a></li><li class="nk-menu-item"><a href="/storage.html" class="nk-menu-link nk-menu-switch" data-target="navDashboards"><span class="nk-menu-icon"><em class="icon ni ni-hard-drive"></em></span></a></li><li class="nk-menu-hr"></li><li class="nk-menu-item"><a href="/comparison.html" class="nk-menu-link nk-menu-switch" data-target="navDashboards"><span class="nk-menu-icon"><em class="icon ni ni-img-fill"></em></span></a></li><li class="nk-menu-item"><a href="/message.html" class="nk-menu-link nk-menu-switch" data-target="navDashboards"><span class="nk-menu-icon"><em class="icon ni ni-chat-circle"></em></span></a></li><li class="nk-menu-item"><a href="/motion.html" class="nk-menu-link nk-menu-switch" data-target="navDashboards"><span class="nk-menu-icon"><em class="icon ni ni-chat-fill"></em></span></a></li><li class="nk-menu-hr"></li><li class="nk-menu-item"><a href="/schenario.html" class="nk-menu-link nk-menu-switch" data-target="navDashboards"><span class="nk-menu-icon"><em class="icon ni ni-star-round"></em></span></a></li><li class="nk-menu-item"><a href="/bootstrap.html" class="nk-menu-link nk-menu-switch" data-target="navDashboards"><span class="nk-menu-icon"><em class="icon ni ni-bootstrap"></em></span></a></li>
</ul>
isImageFile & isVideoFile
var isImageFile = function(fileName) {var imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp', 'tif', 'tiff'];var fileExtension = getFileExtension(fileName).toLowerCase();return imageExtensions.includes(fileExtension);
}
var isVideoFile = function(fileName) {var imageExtensions = ['mp4', 'webm', 'mki', 'ogg'];var fileExtension = getFileExtension(fileName).toLowerCase();return imageExtensions.includes(fileExtension);
}
isImage & isVideo
var isImage = function(obj) {return obj && obj.tagName === 'IMG' || obj.nodeName === 'IMG';
};
var isVideo = function(obj) {return obj && obj.tagName === 'VIDEO' || obj.nodeName === 'VIDEO';
};