Zend certified PHP/Magento developer

Sticky Navbar Magento2

I want to make the navigation bar to be sticky. I completed it in the below way. Now I want to make the logo to display in the navbar when we scroll. I don’t know how to add the logo to the navbar via jquery. I tried this way but I am getting the logo getting cloned many times in the navbar. suggest me hoe to add the logo to navbar via jquery.

            define([
            'jquery' 
            ],
            function($){  
            'use strict';
            $(window).scroll(function(){
            var $window = $(window);
            var windowsize = $window.width();
            var height = $(document).scrollTop();
            if(height > 180 ) {
                $(".logo").clone().appendTo(".nav-sections");
                $('.nav-sections').addClass('sticky');
            $('.page-header').addClass('sticky-header'); 
            }else{
                $('.nav-sections').removeClass('sticky');
                $('.page-header').removeClass('sticky-header'); 
            }
            });
            });