jQuery Plugin To Fix Any Elements On The Top - Fixit

File Size: 6.86 KB
Views Total: 1519
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
jQuery Plugin To Fix Any Elements On The Top - Fixit

Fixit is a lightweight and easy-to-use jQuery plugin which helps you fix any element (e.g. navigation, sidebar, etc.) on the top of the webpage according to the options passed. You can also add class to the element when it is fixed. It also trigger events when element is "fixed" and "unfixed".

How to use it:

1. Add the jQuery Fixit plugin's script after you've added jQuery library.

<script src="//code.jquery.com/jquery-3.0.0.min.js"></script>
<script src="jquery.fixit.js"></script>

2. Each element to be fixed must have an unique ID as follow:

<div id="demo">

3. Just call the fixit() function and the plugin will do the rest.


4. Add a custom space between your element and the page top.

  topMargin  :  30

5. Add a custom CSS class to your element when fixed.

  addClassAfter : 'my-class'

6. Determine if the dimension of the element should be same after it is fixed.

  sameDimension : true

7. Set the stack order of your element when fixed.

  zIndex : 999

8. More options.

  offset: 0,
  reset: false,
  direction: false, // down or up

9. Events available.

  // when fixed

  // when unfixed

Change log:


  • Added missing “px” to pixel values


  • Added: direction, reset, offset option and refactored the code.


  • minor fixes

This awesome jQuery plugin is developed by itsprakash87. For more Advanced Usages, please check the demo page or visit the official website.