Действия

Widget

Порталы: различия между версиями

Материал из ВикиВоины

Строка 155: Строка 155:
 
   $(window).scroll(function() {
 
   $(window).scroll(function() {
 
   var scrollTop = $(window).scrollTop();
 
   var scrollTop = $(window).scrollTop();
 
+
  var currentPosition = $(this).scrollTop();
    if (scrollTop > sidebarTop && scrollTop > portalContentsTop && !isFixed) {
 
        portalContents.addClass('fixed');
 
        isFixed = true;
 
    } else if ((scrollTop <= sidebarTop || scrollTop <= portalContentsTop) && isFixed) {
 
        portalContents.removeClass('fixed');
 
        isFixed = false;
 
    }
 
});
 
 
 
$(window).scroll(function() {
 
    var currentPosition = $(this).scrollTop();
 
  
 
     $('.sections_title, .period_title').each(function() {
 
     $('.sections_title, .period_title').each(function() {
Строка 175: Строка 164:
 
             $('.portal-contents li').removeClass('active');
 
             $('.portal-contents li').removeClass('active');
  
             $('.portal-contents a[href="#' + sectionId + '"]').closest('li').addClass('active');
+
             $('.portal-contents a[href="#' + sectionId + '"]').parent().addClass('active');
 
         }
 
         }
 
     });
 
     });
 +
 +
    if (scrollTop > sidebarTop && scrollTop > portalContentsTop && !isFixed) {
 +
        portalContents.addClass('fixed');
 +
        isFixed = true;
 +
    } else if ((scrollTop <= sidebarTop || scrollTop <= portalContentsTop) && isFixed) {
 +
        portalContents.removeClass('fixed');
 +
        isFixed = false;
 +
    }
 
});
 
});
 +
  
  

Версия 10:40, 5 мая 2024