Sindbad~EG File Manager

Current Path : /home/xiedrke/malino/wp-content/plugins/trendz-plus/modules/menu/assets/js/
Upload File :
Current File : /home/xiedrke/malino/wp-content/plugins/trendz-plus/modules/menu/assets/js/mega-menu.js

jQuery.noConflict();
jQuery(document).ready(function($) {
    "use strict";

    // Sticky Row
    if( $("#header-wrapper .sticky-header").length > 0 ) {
        var $sticky_header_cloned = $('.sticky-header').clone();
        $sticky_header_cloned.removeClass('sticky-header').addClass('sticky-header-active');
        $( $sticky_header_cloned ).insertAfter( $('.sticky-header') );

        $sticky_header_cloned.find('.wdt-header-icons-list-item.search-item.search-overlay').each(function() {
        var $searchContainer = $(this).find('.wdt-search-form-container');
            if ($searchContainer.length) {
                $searchContainer.remove(); 
            }
        });
        
        $('body').css('--sticky-header-height', $('.sticky-header-active').outerHeight() + 'px');

        var position = $(window).scrollTop();

        $(window).scroll(function() {
            var scroll = $(window).scrollTop();
            if((scroll > 0 && position > 0) && scroll > position) {
                $("#header-wrapper .sticky-header-active").addClass('wdt-header-top');
                $("#header-wrapper .sticky-header-active").addClass('wdt-header-scroll');

                $("#header-wrapper .sticky-header-active").show();
            } else {
                 $("#header-wrapper .sticky-header-active").removeClass('wdt-header-top');
                 $("#header-wrapper .sticky-header-active").removeClass('wdt-header-scroll');
            }
            position = scroll;
        });
    }

    // Mega Menu
    function megaMenu() {

        var $header = 0;
        if( $("#header .container").length ) {
            $header = $("#header .container").offset().left;
        }
        $("li.has-mega-menu").each(function(){
            var $parent      = $(this),
                $parent_left = $parent.offset().left,
                $sub_menu    = $parent.children("ul.sub-menu"),
                $section     = $sub_menu.find('section');

            if( $section.hasClass('elementor-section-stretched') ) {
            	setTimeout(function() {
           			$sub_menu.css('left', - ( $parent_left ) );

            		var pad = $sub_menu.css('padding-left');
            		$section.css('left', - ( parseInt(pad) ) );

                    var windowWidth = $(window).width();
                    $sub_menu.css('width', parseInt( windowWidth ) );
            	}, 100);
            } else {
                $sub_menu.css('left', ( $header - $parent_left ) );
                if( !($("#header .container").length) ) {
                    $sub_menu.css('width', ( document.documentElement.clientWidth ) );
                }
            }
        });
    }
    megaMenu();

    $(window).on("resize", function() {
        megaMenu();
    });
});

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists