Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require([
  2.     'jquery',
  3. ], function ($) {
  4.  
  5.     $(document).ready(function(){
  6.         var altura = $('.page-header').offset().top;
  7.         var altura2 = $('.nav-sections').offset().top;
  8.  
  9.         $(window).on('scroll', function(){
  10.             if ( $(window).scrollTop() > altura ){
  11.                 if($('#ticker').length > 0) {
  12.                     $('.page-header').addClass('menu-fixed');
  13.                 } else {
  14.                     $('.page-header').addClass('menu-fixed-sin-ticker');
  15.                 }
  16.             }else {
  17.                 $('.page-header').removeClass('menu-fixed');
  18.                 $('.page-header').removeClass('menu-fixed-sin-ticker');
  19.             }
  20.  
  21.             if ( $(window).scrollTop() > altura ){
  22.                 if($('#ticker').length > 0) {
  23.                     $('.nav-sections').addClass('nav-fixed');
  24.                 } else {
  25.                     $('.nav-sections').addClass('nav-fixed-sin-ticker');
  26.                 }
  27.             } else {
  28.                 $('.nav-sections').removeClass('nav-fixed');
  29.                 $('.nav-sections').removeClass('nav-fixed-sin-ticker');
  30.             }
  31.             if ( $(window).scrollTop() > altura ){
  32.                 $('.widget').addClass('widget-fixed');
  33.             } else {
  34.                 $('.widget').removeClass('widget-fixed');
  35.             }
  36.         });
  37.     });
  38. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement