Advertisement
badlogic

Jquery Sticky element on top

Sep 9th, 2020
1,210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <style type="text/css">
  2.         @import url('../../site.css');
  3.  
  4.         .ifScroll{
  5.             position: fixed;
  6.             top: 0;
  7.             z-index: 1;
  8.             border: 1px solid #f4f4f4;
  9.             background-color: white;
  10.             border-bottom-right-radius: 3px;
  11.             font-size: xx-large;
  12.             width: auto;
  13.         }
  14.     </style>
  15.  
  16.  
  17.  
  18.  
  19. <div class="breadCrumbs01 text-right breadcrumb text-muted" >
  20.                         <p class="pull-left">
  21.                             <b>Active SY:</b> <i style="color: green"><?= !empty($_SESSION['admin_session_obj']['syinfo']['sy_name'])  ? $_SESSION['admin_session_obj']['syinfo']['sy_name'] : "NOT YET SET"?></i> <b>||</b> <b>Active College Semester:</b> <i style="color: green"><?= !empty($_SESSION['admin_session_obj']['semesterinfo']['cs_description']) ? $_SESSION['admin_session_obj']['semesterinfo']['cs_description'] : "Not Yet Set"?></i>
  22.                         </p>
  23.                         <i class="fa fa-dashboard"></i> <?= $breadCrumbs; ?>
  24.                     </div>
  25.  
  26.  
  27.  
  28.  
  29.  
  30. <script type="text/javascript">
  31.     $(function(){
  32.         $("div").scroll(function(){
  33.             console.log('asdasdasd');
  34.             $('.breadCrumbs01').attr('class','ifScroll');
  35.             console.log($(this).scrollTop())
  36.             if($(this).scrollTop() < 20){
  37.                 $('.ifScroll').attr('class','breadCrumbs01 text-right breadcrumb text-muted');
  38.                 console.log('wee');
  39.             }
  40.  
  41.  
  42.         });
  43.     });
  44.  
  45. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement