Socket
Socket
Sign inDemoInstall

@borngroup/born-fixit

Package Overview
Dependencies
0
Maintainers
3
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @borngroup/born-fixit

Sets a class on a target element to make it sticky. Allows to set a bounds element to constrain the sticky element's scrolling.


Version published
Weekly downloads
200
decreased by-22.18%
Maintainers
3
Install size
135 kB
Created
Weekly downloads
 

Readme

Source

BORN FixIt

Sets elements to 'position: fixed;' after window has scrolled to the 'target' element. Allows to set boundaries and other options.

Options and Callbacks

target: [HTMLElement] [REQUIRED] Target HTML Element to make sticky.

offset: [Integer | Selector | HTMLElement] Default: 0. Offset value or element referebce to set the target element as 'sticky', from top. Added as pixels.

useOffsetOnTarget: [Boolean] Default: false. adds the offset value as position 'top: value;'.

respondToParent: [Boolean | HTMLElement] Default: false. If 'target' element is not meant to be full width, make it use the width of it's closest parent. Alternatively, pass an HTMLElement to use instead of the closest parent.

containedInParent: [boolean | HTMLElement] Default: false. If an HTMLElement is provided, use that as the boundaries for the 'sticky' element. Set to TRUE to use closest parent, relative to the 'target' element.

enabled: [function] Runs once before initiallizing the module. If false is returned, the module will not initialiize.

Usage

var myFixedElement = new FixIt({
	target: document.querySelector('.my-sticky-element'),
	offset: 50,
	enabled: function() {   
	            //Do something
	            if (myCondition) {
	                return true;
	            }
	            return false;
	         },
});

Keywords

FAQs

Last updated on 08 Apr 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc