• Stars
    star
    872
  • Rank 52,060 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 12 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Make items sticky as you scroll, to a point.

Make items sticky as you scroll, to a point. (See Demo)

Usage

<div class="container">
	<div class="row stickem-container">
		<div class="content">
			Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
		</div>
		
		<div class="aside stickem">
		  I'm gonna be sticky!
		</div>
	</div>
</div>
.stickem-container {
  position: relative;
}

.stickit {
	margin-left: 660px;
	position: fixed;
	top: 0;
}

.stickit-end {
	bottom: 40px;
	position: absolute;
	right: 0;
}
$('.container').stickem();

Defaults

item: '.stickem'
Items that you want to stick on scroll.

container: '.stickem-container'
Container that you want the sticky item to be contained in.

stickClass: 'stickit'
Class added to the sticky item once it should start being sticky.

endStickClass: 'stickit-end'
Class added to the sticky item once it has reached the end of the container

offset: 0
Do you already have a fixed horizontal header on the page? Offset stick 'em by that many pixels.

start: 0
If your sticky item isn't at the top of the container, tell it where it should start being sticky.

onStick: null
You can create a callback function that fires when an item gets "stuck". The item gets passed back.

onUnstick: null
You can create a callback function that fires when an item gets "un-stuck". The item gets passed back.

Destroying

If you have a bunch of stuff that happens after your page has loaded (e.g. AJAX requests) that changes the height of your containers and page, and you need to "destroy" stick 'em, do it like this:

var sticky = $('.container').stickem();
sticky.destroy();

Then you can re-instantiate again if you need to.

More Repositories

1

jQuery-One-Page-Nav

Smooth scrolling and smart navigation when user scrolls on one-page sites.
HTML
1,523
star
2

jQuery-Presentation

No need for Keynote or PowerPoint anymore, use a browser to give presentations
JavaScript
118
star
3

YouTube-Chromeless

jQuery YouTube Chromeless Video Plugin
JavaScript
82
star
4

css-diamond-grid

A responsive grid of diamonds.
Ruby
74
star
5

craft-reroute

Manage 301/302 redirects in the control panel.
PHP
60
star
6

craft-shopify

Craft plugin that integrates with the Shopify API
PHP
59
star
7

nested-responsive-grid

Generate a responsive grid that maintains it’s column sizes two levels deep.
Ruby
41
star
8

Image-Scroller

JavaScript
26
star
9

craft-listing-section

PHP
26
star
10

Hon-ee-Pot-Captcha

ExpressionEngine 2.0 Hon-ee Pot Captcha to work with the Freeform module and comment form
PHP
25
star
11

jQuery-Show-Password

Adds a link to toggle the masking of a password input field.
JavaScript
24
star
12

craft-bust

Plugin for Craft to cache bust files
PHP
22
star
13

jQuery-Simple-Validate

Super light-weight jQuery form validation
JavaScript
20
star
14

craft-guzzle

Craft plugin to get a Guzzle response.
PHP
16
star
15

Starter-Template

Super-basic HTML5 starting template
CSS
9
star
16

is-ajax

ExpressionEngine plugin to determine if it's an AJAX request
PHP
8
star
17

fix-ee

A couple of EE CP tweaks
PHP
6
star
18

refresh-dc-compass-sass-presentation

Refresh DC Presentation about Compass and Sass
Ruby
6
star
19

Config-Variables-Plugin

Access ExpressionEngine 2 Config Variables
PHP
4
star
20

EE-Default-CP-Tabs

Add in default tabs for new members
PHP
4
star
21

jQuery-RequiredForm

jQuery form validation plugin for browsers that don't support HTML5 validation.
CSS
3
star
22

trevordavis-remix

TypeScript
3
star
23

ee-simple-preview

ExpressionEngine accessory that adds a preview link to the "preview" page.
PHP
3
star
24

EE-Scroll-To-Comment

ExpressionEngine 2.0: Scroll directly to a new comment after submission
PHP
2
star
25

EE-Multi-Relationship-Checkboxes

Modified version of Mark Huot's Multi Relation extension that uses checkboxes instead of a multi-select
2
star
26

heelp

ExpressionEngine accessory to provide channel specific help on the publish pages.
PHP
2
star
27

HP-Demo

Demo site for presentation
PHP
1
star
28

north-cannabis-co-remix

Not maintained by dutchie, just an quick and dirty exploration using Dutchie+
TypeScript
1
star
29

Gallant

PHP
1
star
30

fedsacrifice

FED Sacrifice Site
JavaScript
1
star
31

dumbwaiter

Chrome Extension to move data from one page to another
JavaScript
1
star
32

segment_category_info

ExpressionEngine plugin to return category info by passing in the category_url_title and channel_short_name.
PHP
1
star