Jump to content

'Динамическое меню навигации'


Go to solution Solved by ANDROS,

Recommended Posts

csolsztyn
Браток
Prestiges:
0
Member's total reputation:
196
Content Count:
287
Solved Topics:
coins:
0

1.gif.93ea0c0ceb24c88cb45e7a254d28d752.gif

  • Core -> Front -> Global -> GlobalTemplate
  • Ищем строку
{template="includeJS" if="theme.js_include == 'footer'" app="core" group="global" location="global" params=""}
  • После неё вставляем
<script>
            $('#elSearchNavContainer').addClass('original').clone().insertAfter('#elSearchNavContainer').addClass('cloned').css('position','fixed').css('top','0').css('margin-top','0').css('z-index','2000').removeClass('original').hide();
            $('.cloned #elSearch').remove();
   
            $(document).ready(function() {
                var stickyNavTop = $('#elSearchNavContainer').offset().top;
   
                window.addEventListener("resize", clone);
                function clone() {
                    var test = document.getElementById('elSearchNavContainer').offsetWidth;
                    $('.cloned').css('width',test);
                }
   
                var stickyNav = function(){
                    var scrollTop = $(window).scrollTop();
   
                    if (scrollTop > stickyNavTop) {
                        $('.cloned').css('display', 'inline');
                        $('.original').css('visibility', 'hidden');
                        $('.original #elSearch').appendTo('.cloned');
                    } else {
                        $('.cloned').css('display', 'none');
                        $('.original').css('visibility', 'visible');
                        $('.cloned #elSearch').appendTo('.original');
                    }
                };

                stickyNav(); clone();
     
                $(window).scroll(function() {
                    stickyNav();
                });
            });
        </script>

 

Link to post
Share on other sites
  • Авторитет
  • Solution

ANDROS
Авторитет
Prestiges:
6
Member's total reputation:
360
Content Count:
674
Solved Topics:
  14
coins:
10693

Давно искал) Но потом нашел выход. Стандартным способом:

в navBar добавляем следующую строчку 

data-ipsSticky

Снимок.PNG

Правила форума       Правила оформления контента       Приватный форум и чат

podpis.png

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Privacy Policy