cancel
Showing results for 
Search instead for 
Did you mean: 

How can I add search in the sticky menu. The script looks like this:

How can I add search in the sticky menu. The script looks like this:

How can I add search in the sticky menu. The script looks like this:

 

<?php
    $store = Mage::app()->getStore();    $code  = $store->getCode();
?>
<script type="text/javascript">    jQuery(function($){
        var scrolled = false;        $(window).scroll(function(){
                if(140<$(window).scrollTop() && !scrolled){
                    if(!$('.header-container .menu-wrapper .mini-cart').length && !$('.header-container .menu-wrapper .sticky-logo').length){                    $('.header-container').addClass("sticky-header");
                    var minicart = $('.header-container .mini-cart').html();                    $('.header-container .menu-wrapper').append('<div class="mini-cart">'+minicart+'</div>');
                <?php if(Mage::getStoreConfig('porto_settings/header/sticky_header_logo', $code)): ?>
                    var logo_image = $('<div>').append($('.header-container .header > .logo').clone()).html();                    $('.header-container .menu-wrapper').prepend('<div class="sticky-logo">'+logo_image+'</div>');
                    <?php if(Mage::getStoreConfig('porto_settings/header/sticky_header_logo_img', $code)):?>                    $(".sticky-logo img").attr("src","<?php echo $this->getSkinUrl(Mage::getStoreConfig('porto_settings/header/sticky_header_logo_img', $code)); ?>");                    $('.header-container.type15.sticky-header .header > .logo img').addClass("hide");                    $('.header-container.type15.sticky-header .header > .logo img.sticky-logo-image').remove();                    $('.header-container.type15.sticky-header .header > .logo').append('<img src="<?php echo $this->getSkinUrl(Mage::getStoreConfig('porto_settings/header/sticky_header_logo_img', $code)); ?>" class="sticky-logo-image" alt="Sticky Logo"/>');
                    <?php endif; ?>
                <?php endif; ?>                    $('.header-container .header-wrapper > div').each(function(){
                        if($(this).hasClass("container")){                            $(this).addClass("already");
                        } else {                            $(this).addClass("container");
                        }
                    });                    scrolled = true;
                    }
                }
                if(140>=$(window).scrollTop() && scrolled){                    $('.header-container').removeClass("sticky-header");                    $('.header-container .menu-wrapper .mini-cart').remove();
                <?php if(Mage::getStoreConfig('porto_settings/header/sticky_header_logo', $code)): ?>                    $('.header-container .menu-wrapper > .sticky-logo').remove();                    $('.header-container.type15 .header > .logo img.sticky-logo-image').remove();                    $('.header-container.type15 .header > .logo img').removeClass("hide");
                <?php endif; ?>                    scrolled = false;                    $('.header-container .header-wrapper > div').each(function(){
                        if($(this).hasClass("already")){                            $(this).removeClass("already");
                        } else {                            $(this).removeClass("container");
                        }
                    });
                }
        });
    });
</script>