CSS-Tricks Example

Inset Border Effect jQuery Plugin

by Robin Thrift

This plugin puts a border around the targeted elements (typically images), but unlike normal CSS borders it covers up part of the image. When the element is hovered over, the border animates to the sides, revealing the whole image.

DOWNLOAD v1.0


Usage

Simple:

$("img").insetBorder();

All options:

$("img").insetBorder({
  speed          : 1000,           // 1000 = 1 second, default 250
  borderColor    : "orangered",    // Default white (#ffffff)
  inset          : 10,             // Border width, default 10px
  borderType     : "solid",        // Border type, e.g. dashed
  outerClass     : "ibe_outer",    // Class name of outer wrap
  innerClass     : "ibe_inner"     // Class name of inner border
});

Settings Generator


  • text
  • text
  • text

Default

$(selector).insetBorder();
  • text
  • text
  • text

Big Border

$(selector).insetBorder({
  inset: 50
});
  • text
  • text
  • text

Colored Border

$(selector).insetBorder({
  borderColor: "#d8b231"
});
  • text
  • text
  • text

Slower Speed

$(selector).insetBorder({
  speed: 500
});
  • text
  • text
  • text

Double Border

$("selector").insetBorder({
  borderType: "double"
});

Rectangles

$("selector").insetBorder();