Wednesday, June 17, 2015

Simple 'Sticky' Plugin compatible with SharePoint 2010 + SharePoint 2013

Sticky elements. Not only do they make me hungry when I hear about them, but they are also very nice for keeping the user aware of their current context, keeping some key UI elements like toolbars in close reach, and I am sure lots of other things.


Here is a very tiny jQuery plugin that I developed for making elements sticky. There are many others out there - some that do more - but none I could find that were 100% compatible with the default SharePoint master pages. If you have done any work with the scrollable areas within the default SharePoint HTML, you know what I am talking about. The way the ribbon and the 'workspace' areas work are a little funky. This plugin gives you the power of sticky within this context - and should also work fine for any situation where you want something to be sticky within a scrollable DIV element.


Usage:
  1. Include script in page.
  2. $("<selector>").floater();


Options:
  • startOffset  When the 'stickiness' should be invoked.
  • offsetY  When stuck, how close to the parent element should element be.
  • stickyClass Css class added to element when stuck. Removed when un-stuck.
  • onStart Event to invoke when sticky happens.
  • onStop Event to invoke when un-sticky happens.

No comments:

Post a Comment

 
© I caught you a delicious bass.
Back to top