Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hc-sticky

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hc-sticky - npm Package Compare versions

Comparing version 1.2.43 to 2.0.1

bower.json

43

package.json
{
"name": "hc-sticky",
"version": "1.2.43",
"description": "Cross-browser jQuery plugin that makes any element attached to the page and always visible while you scroll.",
"main": "jquery.hc-sticky.js",
"scripts": {
"test": "echo \"There are no tests :(\""
"version": "2.0.1",
"description": "Cross-browser plugin that makes any element on your page visible while you scroll",
"main": "dist/hc-sticky.js",
"author": "Some Web Media",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"babel-core": "^6.25.0",
"babel-plugin-check-es2015-constants": "^6.22.0",
"babel-plugin-transform-es2015-arrow-functions": "^6.22.0",
"babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0",
"babel-plugin-transform-es2015-block-scoping": "^6.26.0",
"cheerio": "^0.22.0",
"eventie": "^1.0.6",
"glob": "^7.1.2",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^4.0.0",
"gulp-babel": "^7.0.0",
"gulp-concat": "^2.6.1",
"gulp-open": "^2.0.0",
"gulp-sass": "^3.1.0",
"gulp-template": "^4.0.0",
"gulp-uglify": "^1.5.3"
},
"repository": {
"type": "git",
"url": "git+https://github.com/daytonn/hc-sticky.git"
},
"keywords": [
"sticky",
"jquery",
"garbage"
],
"author": "Some Web Media <somewebmedia@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/daytonn/hc-sticky/issues"
},
"homepage": "https://github.com/daytonn/hc-sticky#readme"
"url": "git+https://github.com/somewebmedia/hc-sticky.git"
}
}
HC-Sticky
=========
> v.1.2.43
Cross-browser plugin that makes any element on your page visible while you scroll.
Cross-browser jQuery plugin that makes any element attached to the page and always visible while you scroll.
## Usage
```html
<script src="/path/to/hc-sticky.js"></script>
##Call the plugin
<script>
// call this script just before closing </html> or after your #element
var Sticky = new hcSticky('#element', {
stickTo: '#content'
});
</script>
```
### jQuery
```html
<script src="/path/to/jquery.js"></script>
<script src="/path/to/jquery.hc-sticky.js"></script>
<script src="/path/to/hc-sticky.js"></script>
<script>
jQuery(document).ready(function($){
$('#element').hcSticky();
});
jQuery(document).ready(function($) {
$('#element').hcSticky({
stickTo: '#content'
});
});
</script>
```
## Options and callbacks
## Options
Options can be updated at any time by calling the plugin again.
HC Sticky has a wide range of options you can set to have a full controll over the sticky elements.
Example:
```javascript
$('#element').hcSticky({
top: 50
});
```
| Property | Default | Type | Description |
|-----------|---------|-------|-------------|
| *`top`* | 0 | int | The distance from the top of the *Window* at which to trigger HC-Sticky. |
| *`bottom`* | 0 | int | The distance from the bottom of the *Window* at which to attach HC-Sticky. |
| *`innerTop`* | 0 | int | The distance from the top inside of the sticky element at which to trigger HC-Sticky. |
| *`innerSticker`* | null | string / element object | Element inside of the sticky element at which to attach HC-Sticky. This has higher priority than innerTop option. |
| *`bottomEnd`* | 0 | int | The distance from the bottom of the referring element at which to stop HC-Sticky. |
| *`stickTo`* | null (parent element) | string / element object | Element that represents the reference for height instead of height of the container. |
| *`followScroll`* | true | boolean | When set to `false`, sticky content will not move with the page if it is bigger than *Window*. |
| *`stickyClass`* | 'sticky' | string | HTML class that will be applied to sticky element while it is attached. |
| *`queries`* | null | object | Object containing responsive breakpoints, on which you can tell HC Sticky what to do. |
| *`onStart`* | null | function | Callback function fired when the element becomes attached. |
| *`onStop`* | null | function | Callback function fired when the element stops floating. |
| *`onBeforeResize`* | null | function | Callback function fired before sticky has been resized (happens after *Window* resize and before sticky reinit). |
| *`onResize`* | null | function | Callback function fired after sticky has been resized (happens after *Window* resize and sticky reinit). |
| *`resizeDebounce`* | 100 | int | Limit the rate at which the HC Sticky can fire on window resize. |
<table>
<tr>
<th>Property</th>
<th>Default</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><strong>top</strong></td>
<td>0</td>
<td>int</td>
<td>The distance from the top of the Window at which to trigger HC-Sticky.</td>
</tr>
<tr>
<td><strong>bottom</strong></td>
<td>0</td>
<td>int</td>
<td>The distance from the bottom of the Window at which to glue HC-Sticky.</td>
</tr>
<tr>
<td><strong>innerTop</strong></td>
<td>0</td>
<td>int</td>
<td>The distance from the top inside of the sticky content at which to trigger HC-Sticky.</td>
</tr>
<tr>
<td><strong>innerSticker</strong></td>
<td>null</td>
<td>jQuery selector</td>
<td>Element at which to trigger HC-Sticky instead of top of sticky container. This has higher priority than innerTop option.</td>
</tr>
<tr>
<td><strong>bottomEnd</strong></td>
<td>0</td>
<td>int</td>
<td>The distance from the bottom of the referring element at which to stop HC-Sticky.</td>
</tr>
<tr>
<td><strong>stickTo</strong></td>
<td>null</td>
<td>jQuery selector / jQuery object</td>
<td>Element that represents the reference for height instead of height of the container. Use<code>document</code> for top menus.</td>
</tr>
<tr>
<td><strong>responsive</strong></td>
<td>true</td>
<td>boolean</td>
<td>When set to <code>true</code>, HC-Sticky will recalculate its dimensions and position on resize.</td>
</tr>
<tr>
<td><strong>offResolutions</strong></td>
<td>null</td>
<td>int / array</td>
<td>Set resolutions at which HC-Sticky will turn itself off. If integer is negative, it will turn off below given resolution, if positive it will turn off above it. Example: <code>[-780, 1600]</code></td>
</tr>
<tr>
<td><strong>followScroll</strong></td>
<td>true</td>
<td>boolean</td>
<td>When set to <code>false</code>, sticky content will not move with the page if it is bigger that Window.</td>
</tr>
<tr>
<td><strong>className</strong></td>
<td>"sticky"</td>
<td>string</td>
<td>HTML class that will be applied to sticky element while it is floating.</td>
</tr>
<tr>
<td><strong>wrapperClassName</strong></td>
<td>"wrapper-sticky"</td>
<td>string</td>
<td>HTML class that is set to wrapper that HC-Sticky creates around your sticky element.</td>
</tr>
<tr>
<td><strong>onStart</strong></td>
<td>false</td>
<td>function</td>
<td>Callback function on plugin Start event (when the element starts floating).</td>
</tr>
<tr>
<td><strong>onStop</strong></td>
<td>false</td>
<td>function</td>
<td>Callback function on plugin Stop event (when the element stops floating and returns to its normal state).</td>
</tr>
</table>
## Methods
## Commands
Methods are used to control the plugin after initialization.
Commands are used to control the plugin after initialization.
Example:
```javascript
$('#element').hcSticky('stop');
var Sticky = new hcSticky('#element', {
stickTo: '#content'
});
Sticky.update({
top: 20
});
```
<table>
<tr>
<th>Command</th>
<th>Description</th>
</tr>
<tr>
<td><strong>stop</strong></td>
<td>Stops the sticky while preserving its current position.</td>
</tr>
<tr>
<td><strong>off</strong></td>
<td>Turnes off the sticky completely.</td>
</tr>
<tr>
<td><strong>on</strong></td>
<td>Turns the sticky back on after above two commands.</td>
</tr>
<tr>
<td><strong>reinit</strong></td>
<td>Recalculates sticky size. Useful after altering DOM elements inside sticky.</td>
</tr>
<tr>
<td><strong>destroy</strong></td>
<td>Completely destroys sticky and reverts element to original state.</td>
</tr>
</table>
| Method | Accepts | Description |
|---------|---------|--------------|
| *`options`* | string | Returns current settings, or a specific setting if you specify it. |
| *`update`* | object | Updates the settings with the new ones. |
| *`reinit`* | | Recalculates sticky size and position. Useful after altering DOM elements inside sticky. |
| *`detach`* | | Detaches the HC-Sticky from element, preventing it from running. |
| *`attach`* | | Attaches the HC-Sticky back to the element. |
| *`destroy`* | | Completely destroys HC-Sticky and reverts element to original state. |
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc