Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
197
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-ticker'); // CREATE LA CLASE Y SACALE EL TOP 45px
  15.             }
  16.         }else {
  17.             $('.page-header').removeClass('menu-fixed');
  18.         }
  19.  
  20.         if ( $(window).scrollTop() > altura ){
  21.             if($('#ticker').length() > 0) {
  22.                 $('.nav-sections').addClass('nav-fixed');
  23.             } else {
  24.                 $('.nav-sections').addClass('nav-fixed-ticker'); //CREATE LA CLASE Y PONELE UN TOP 115PX
  25.             }
  26.         } else {
  27.             $('.nav-sections').removeClass('nav-fixed');
  28.         }
  29.         if ( $(window).scrollTop() > altura ){
  30.             $('.widget').addClass('widget-fixed');
  31.         } else {
  32.             $('.widget').removeClass('widget-fixed');
  33.         }
  34.     });
  35. });
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement