/** * @copyright Commercial License By LeoTheme.Com * @email leotheme.com * @visit http://www.leotheme.com */ $(document).ready(function () { $.each(list_menu, function (index, value) { // console.log(value.type); if (value.type == 'horizontal') { var megamenu_element = $('.cavas_menu[data-megamenu-id=' + value.id + ']') // console.log(megamenu_element); //type horizontal menu //check active link if ($('body').attr('id') == 'index') isHomeMenu = 1 megamenu_element.find('.megamenu > li > a').each(function () { menuURL = $(this) .attr('href') .replace('https://', '') .replace('http://', '') .replace('www.', '') .replace(/#\w*/, '') if ( currentURL == menuURL || currentURL.replace(current_link, '') == menuURL || isHomeMenu ) { $(this).parent().addClass('active') return false } }) //check target // console.log($(window).width()); if ($(window).width() <= 767) { set_target_blank(false, megamenu_element) // set cavas NO } else { set_target_blank(true, megamenu_element) // set cavas Yes } // console.log('test'); // console.log(show_cavas); //off canvas menu if (value.show_cavas == 1) { // console.log('test'); $.fn.OffCavasmenu = function (opts) { // default configuration var config = $.extend( {}, { opt1: null, text_warning_select: text_warning_select_txt, text_confirm_remove: text_confirm_remove_txt, JSON: null, }, opts ) // main function // initialize every element this.each(function () { // console.log('test'); var $btn = megamenu_element.find('.navbar-toggler') // console.log($btn); var $nav = null if (!$btn.length) return var $nav = $( "' ) // console.log($($btn.data('target')).find('.megamenu')); var $menucontent = $($btn.data('target')).find('.megamenu').clone() $('body').append($nav) $('body #page').append( "