Skip to content

Repository files navigation

okshadow

OKShadow by OKFocus

OKShadow is a jQuery plugin that produces drop shadows that track the mouse cursor. Many effects are possible, including depth-of-field simulation and focus effects. See examples here.

Usage

OKShadow can bind to any DOM element that recognizes the CSS3 box-shadow or text-shadow property.

Options

optiondescriptiondefault
colorsets shadow color#888
textShadowapplies the shadow to the text; otherwise, the shadow affects the container (“box-shadow”)false
transparentsets text color to transparent for ghost text effectfalse
downwardson mobile browsers, shadows will only move downwardstrue
xMaxhorizontal movement constraint, in pixelsnull
yxOffsethorizontal offset, in pixels0
xFactoraffects blur position based on mouse distance30
yMaxvertical movement constraint, in pixelsnull
yOffsetvertical offset, in pixels0
yFactoraffects blur position based on mouse distance30
fuzzMinminimum blur radius in pixelsnull
fuzzMaxmaximum blur radius in pixelsnull
fuzzFactoraffects blur radius based on mouse distance40

Methods

OKShadow offers the method setoption so parameters can be changed after instantiation. It takes either a hash of parameters or a single key and value. For example:


$('#ok').okshadow();
$('#ok').data("okshadow").setoption({
"color": "red",
"fuzzMin": 10,
});

For use in dynamic web apps, use the pause and unpause methods to turn the effect on and off.

Run Tests

OKFocus tests JavaScript with Jasmine. Run tests:


$ bundle install
$ jasmine init
$ rake jasmine

About

Cursor as light source.

Resources

Stars

71 stars

Watchers

9 watching

Forks

Releases

Packages

Used by

Contributors

Languages