I used .load() function to cut my pages in different parts, like header, menu, footer ...
But I realize that HTML injected with .load() isn't compatible with my jquery functions.
There is a great exemple :
I have a header.html that I load on my main page :
 <div class="row justify-content-end">
    <div class="col-sm-4">
        <nav class="header">
            <ul>
                <li><a href="" target=_blank>Télécharger mon CV</a></li>
                <li>hello@floran.me</li>
                <li><a href="#menu" class="openMenu"><i class="icon icon-sort-bold icon-32"></i></a></li>
            </ul>
        </nav>
    </div>
</div>
On my script.js, I call a page named menu.html by clicking on the burger menu, and that was working before I decided to cut the header into a different page.
$( document ).ready(function() {
    
    var windowWidth = $(window).width();
    var DemiWindow = windowWidth / 2;
    
    // Appels includes
    $('#main-menu').load("includes/menu.html");
    $('.sticky-top').load("includes/header.html");
    
    function openMenu(){
        $('#main-menu').animate({left: 0}, 500, function(){});
        $('.main-content').animate({marginLeft: -DemiWindow}, 1000, function(){
            $('.main-content').css('margin-left', 'auto');
            $(document).on('keydown', function(event) {
                if (event.key == "Escape") {
                $('#main-menu').animate({left: windowWidth}, 500, function(){});
                }
            });
        });
    }
    function closeMenu(){
        $('#main-menu').animate({left: windowWidth}, 500, function(){});
        console.log(windowWidth);
    }
    
    $('#main-menu').css('left', windowWidth);
    
    $(window).resize(function() {
        windowWidth = $(window).width();
        DemiWindow = windowWidth / 2;
        $('#main-menu').css('left', windowWidth);
    });
    
    $('.openMenu').click(openMenu);
    
    $('.closeMenu').click(closeMenu);
    
    
});
I didn't read something about using jquery functions on injected HTML code, do you have a tip to keep it working ?
Thank you!
