- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to use Bootstrap Affix Plugins
The affix plugin allows a <div> to become affixed to a location on the page. You can also toggle it's pinning on and off using this plugin.
The affix plugin toggles between three classes, each representing a particular state − .affix, .affix-top, and .affix-bottom. Follow the below steps to set your CSS for either of the above usage options.
- To start, the plugin adds .affix-top to indicate the element is in its top-most position. At this point, no CSS positioning is required.
- Scrolling past the element you want affixed should trigger the actual affixing. This is where .affix replaces .affix-top and sets position: fixed; (provided by Bootstrap's code CSS).
- If a bottom offset is defined, scrolling past that should replace .affixwith .affix-bottom. Since offsets are optional, setting one requires you to set the appropriate CSS. In this case, add position: absolute; when necessary.
Advertisements