update
This commit is contained in:
@@ -1,76 +0,0 @@
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
// Sự kiện click để hiển thị menu
|
||||
$('#js-show-menu').click(function () {
|
||||
$('#js-menu-big').toggleClass('show');
|
||||
$('#overlay').addClass('active');
|
||||
});
|
||||
|
||||
// hover show danh muc con
|
||||
HoverShowMenu();
|
||||
|
||||
AdminFunctions.searchSuggestions('#js-input-search')
|
||||
})
|
||||
|
||||
|
||||
function clickBackground() {
|
||||
$('#js-menu-big').removeClass('show');
|
||||
$('#overlay').removeClass('active');
|
||||
}
|
||||
|
||||
|
||||
function HoverShowMenu() {
|
||||
const $menuBig = $('#js-menu-big');
|
||||
const $hoverMenu = $('#js-hover-menu');
|
||||
|
||||
$menuBig.find('.box-item .item').on('mousemove', function () {
|
||||
if ($menuBig.hasClass('active')) {
|
||||
const $parentItem = $(this).closest('.box-item');
|
||||
const $hoverContent = $parentItem.find('.hover-menu');
|
||||
|
||||
if ($hoverContent.length) {
|
||||
const offset = $parentItem.offset();
|
||||
const menuWidth = $menuBig.width();
|
||||
const hoverHeight = $hoverContent.outerHeight();
|
||||
const windowHeight = $(window).height();
|
||||
const maxY = $(window).scrollTop() + windowHeight;
|
||||
|
||||
let posX = offset.left + menuWidth;
|
||||
let posY = offset.top;
|
||||
|
||||
if (posY + hoverHeight > maxY) {
|
||||
posY = maxY - hoverHeight - 10;
|
||||
}
|
||||
|
||||
$hoverMenu.addClass('active')
|
||||
.html($hoverContent.html())
|
||||
.css({ left: posX, top: posY });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$hoverMenu.on('mouseleave', function () {
|
||||
$hoverMenu.removeClass('active');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function formatCurrency(a) {
|
||||
var b = parseFloat(a).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1.").toString();
|
||||
var len = b.length;
|
||||
b = b.substring(0, len - 3);
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
function toggleSubMenu(id) {
|
||||
const submenu = $('#' + id);
|
||||
submenu.toggleClass('active');
|
||||
if ($('#js-menu-big .sub-menu').hasClass('active')) {
|
||||
$('#js-menu-big').addClass('active');
|
||||
} else {
|
||||
$('#js-menu-big').removeClass('active');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user