Comparing version 1.2.43 to 2.0.1
{ | ||
"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" | ||
} | ||
} |
187
README.md
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. | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
92082
25
904
16
1
79
1
2