stickyBlock
This is make any block floating on your page easily
Getting started
npm install sticky-block --save
import "sticky-block";
Old way
- Include jQuery
- Include stickyBlock
- Call stickyBlock with your options after window load
Options
Options list:
Name | Description | Type | Default Value |
---|---|---|---|
start | Options at the beginning of a floating | Object |
'element':self ,'border':'top' ,'offset':0
|
start.element | jQuery object (dom) starts floating | jQuery_object |
self |
start.border | Border start element 'top' or 'bottom' |
String |
'top' |
start.offset | Оffset in px before the start floating | Number |
0 |
end | Options at the end of the floating | Object |
'element':null ,'border':'top' ,'offset':0
|
end.element | jQuery object (dom) to the end of the floating | jQuery_object |
null |
end.border | Border end element 'top' or 'bottom' |
String |
'top' |
end.offset | Оffset in px before the end floating | Number |
0 |
top | Offset top during the floating | Number |
0 |
parent | Sets the parent of which is targeted to be absolute positioning for the final position of the current element .
If none of the parent element does not have a position: relative - is the recommended setting to ignore. |
jQuery object |
null |
cache | Сache options (it recommended only for static pages) | Boolean |
false |
animate | Animation effects | String |
false |
wrapperClass | Add class to the wrapper | String |
'' |
returnToInitialState | To return to the initial state. Function must return true | Function |
null |
Events
Events list:
sticky-block-start
- when an element begins floating
sticky-block-end
- when the element reaches the limit
sticky-block-default
- when the element returns to its original position
Methods
destroy
- remove element from stickyBlock
Animation effects
Effects list:
You must connect - jquery.sticky-block-animate.css for animation
- fadeIn
- fadeInDown
- bounceInDown
- bounceIn
- slideInDown
- zoomInDown
- flipInX
- flipInY
Browser Support
All modern browsers and IE9+ (animation effects IE10+)
Example
See example - stickyBlock