Giter Club home page Giter Club logo

hc-sticky's Introduction

HC-Sticky

v.1.2.43

Cross-browser jQuery plugin that makes any element attached to the page and always visible while you scroll.

##Call the plugin

<script src="/path/to/jquery.js"></script>
<script src="/path/to/jquery.hc-sticky.js"></script>
<script>
	jQuery(document).ready(function($){
		$('#element').hcSticky();
	});
</script>

Options and callbacks

Options can be updated at any time by calling the plugin again.

Example:

$('#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 glue HC-Sticky.
innerTop 0 int The distance from the top inside of the sticky content at which to trigger HC-Sticky.
innerSticker null jQuery selector Element at which to trigger HC-Sticky instead of top of sticky container. 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 jQuery selector / jQuery object Element that represents the reference for height instead of height of the container. Usedocument for top menus.
responsive true boolean When set to true, HC-Sticky will recalculate its dimensions and position on resize.
offResolutions null int / array 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: [-780, 1600]
followScroll true boolean When set to false, sticky content will not move with the page if it is bigger that Window.
className "sticky" string HTML class that will be applied to sticky element while it is floating.
wrapperClassName "wrapper-sticky" string HTML class that is set to wrapper that HC-Sticky creates around your sticky element.
onStart false function Callback function on plugin Start event (when the element starts floating).
onStop false function Callback function on plugin Stop event (when the element stops floating and returns to its normal state).

Commands

Commands are used to control the plugin after initialization.

Example:

$('#element').hcSticky('stop');
Command Description
stop Stops the sticky while preserving its current position.
off Turnes off the sticky completely.
on Turns the sticky back on after above two commands.
reinit Recalculates sticky size. Useful after altering DOM elements inside sticky.
destroy Completely destroys sticky and reverts element to original state.

hc-sticky's People

Contributors

somewebmedia avatar

Watchers

James Cloos avatar nabojens avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.