GithubHelp home page GithubHelp logo

imclab / stickyfloat Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yaireo/stickyfloat

0.0 1.0 0.0 257 KB

This plugin makes it possible to have a fixed position element that is relative to it’s parent. A normal fixed positioned element would be “out of context” and is very difficult to use in the most common situations with fluid designs. This plugin solves that problem with as little code as I could possible get it so it will run in the most optimized way, while also allow you to customize it in many important ways which might suit you best.

stickyfloat's Introduction

stickyfloat

This plugin makes it possible to have a fixed position element that is relative to it’s parent. A normal fixed positioned element would be “out of context” and is very difficult to use in the most common situations with fluid designs. This plugin solves that problem with as little code as I could possible get it so it will run in the most optimized way, while also allow you to customize it in many important ways which might suit you best.

1.2KB - minified + gziped

9KB - uncompressed

Demo page

##Benefits

  • Can handle many floated elements, each with it’s own settings
  • Floated elements’ movement can be bound inside their parents’ area
  • Uses Native javascript easing, but using CSS3 transitions would be the optimum (not for IE)
  • Has many settings, such as stick to the bottom or animation style
  • Code is very maintainable and higly efficient
  • Uses requestAnimationFrame with a throttled fall-back

##Example – initialize jQuery('.menu').stickyfloat( {duration: 400} );

##Example – update (change settings for a specific element) jQuery('.menu').stickyfloat('update',{duration : 0, stickToBottom:true });

##Example – destroy (no more floating) jQuery('.menu').stickyfloat('destroy');

Old Browsers (no ES5 support)

Please add this shim before any other script:

<script src='http://cdnjs.cloudflare.com/ajax/libs/es5-shim/2.3.0/es5-shim.js'></script>

##Parameters

duration (200)

The duration of the animation

startOffset (number)

The amount of scroll offset after the animations kicks in

offsetY (number)

The offset from the top when the object is animated

lockBottom (true)

Set to false if you don’t want your floating box to stop at parent's bottom

stickToBottom (false)

Make whatever that is “floating” sticl top the bottom instead to the top

delay (0)

Delay in milliseconds until the animnations starts

easing (linear)

Easing function (jQuery has by default only ‘swing’ & ‘linear’)

cssTransition (false)

if you wish to manualy set your own CSS3 transion styles on the floated element, flag this setting as 'true'

stickyfloat's People

Contributors

yaireo avatar

Watchers

 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.