Skip to the content

Sticker peel

Any element becomes a sticker. Take it by a corner, or by an edge, and it peels with the hand: it folds along a straight crease that follows the pointer at any angle, the part folded over shows the back of the sticker with a soft roll at the fold, it casts a shadow on what is still stuck, and what shows underneath is a second face of your own, a message, a price, another button, not a hole.

Become a member to unlock the full effect today.

Join now

Already a member? Sign in

Documentation

  1. Copy to Webflow

    Add Geist and Geist Mono to your site's fonts (Site settings, Fonts, Google Fonts) before pasting: Webflow removes any font your site has not installed.

  2. Add custom CSS

    The box that carries data-sticker-peel has to hug the front: no padding, no border, nothing else inside but the two faces. And nothing close around a sticker may clip it with overflow: hidden, the flap folds out of its box.
  3. Add custom JS

  4. Use it on your own elements

    Custom attributes
    Select the element on the canvas and open the Settings panel. Under Custom attributes, add a pair: the name on the left, the value on the right.
    Custom attributeWhat it does
    data-sticker-peel Marks a sticker: a box that hugs the element that peels and holds nothing else. It takes no value: leave the value field empty. It carries the settings. Put it around any element of the page, as many as you like; each one peels on its own.
    data-sticker-peel-front On the element that peels, inside the sticker: a card, a label, a link, a picture. It takes no value. It decides the size of the sticker. Without it nothing is mounted, and the console says so. [ Required ]
    data-sticker-peel-under On the face that shows underneath, inside the sticker, after the front. It takes no value. The stylesheet lays it exactly behind the front and hides it until the sticker lifts. Without it the page behind the sticker shows through the fold. [ Optional ]
    data-sticker-peel-label On the sticker, with a few words as its value: what a screen reader says for the button that peels it. Without it the button says Peel back. [ Optional ]
    data-sticker-peel-state Written by the engine on the sticker: idle at rest, lifted under the pointer, peeling in the hand, settling on the way back, held, falling, off, and still or flipped under reduced motion. Never written by hand. [ Optional ]
    Settings
    Every setting is a custom attribute too, added the same way and on the same element. An attribute always wins over the defaults written in the code.
    AttributeDefaultWhat it is
    data-sticker-peel-back-color auto Colour of the back of the sticker, the side the fold shows. Options: auto, the front's own background colour mixed with paper white, and paper white alone under a front with no background; or any CSS colour. Taken out of this block, --sticker-peel-back on the sticker takes over.
    data-sticker-peel-grab corners Where the sticker can be taken from. Options: corners, the four corners; edges, the four sides; all, both; or a list of names among top-left, top-right, bottom-right, bottom-left, top, right, bottom, left, for instance top-right bottom-right. The first name of the list, in that order with top-right first, is the corner the keyboard peels.
    data-sticker-peel-reach clamp(22px, 2.4vw, 36px) Size of the square at each corner that takes the pointer, any CSS unit or a percentage of the sticker; never more than half of it.
    data-sticker-peel-curl clamp(6px, 0.8vw, 12px) Radius of the roll of paper at the fold, any CSS unit.
    data-sticker-peel-shadow 0.5 Strength of the two shadows, the one the flap casts and the one under the roll, 0 to 1.
    data-sticker-peel-lift clamp(12px, 1.5vw, 24px) How far a corner rises when the pointer comes over it, any CSS unit.
    data-sticker-peel-threshold 0.5 Share of the sticker peeled, 0 to 1, from which a release counts as beyond.
    data-sticker-peel-beyond back What a release beyond the threshold does. Options: back, the sticker lays back down as it does before the threshold; hold, it stays peeled where it was left, and a click on its corner lays it back; off, it peels to the end, falls away and leaves the face underneath.
    data-sticker-peel-duration 0.55 Time the sticker takes to lay back down from fully peeled, in seconds; a smaller peel takes its share of it.

What it does

Sticker peel is a cursor animation for Webflow and vanilla JavaScript, with no library. Also called sticker peel effect, peelable sticker or peel off sticker animation.

Any element becomes a sticker. Take it by a corner, or by an edge, and it peels with the hand: it folds along a straight crease that follows the pointer at any angle, the part folded over shows the back of the sticker with a soft roll at the fold, it casts a shadow on what is still stuck, and what shows underneath is a second face of your own, a message, a price, another button, not a hole. Let go and it lays back down with a slightly sticky ease; past a threshold it can also stay peeled, or come off for good and fall away. Under the pointer a corner lifts a little as an invitation. The fold is geometry, not a picture: the front is the page's own element, cut with a clip-path and never turned into a bitmap, so its text stays sharp on any screen and selectable at rest, and a link still works on a click that was not a peel. It holds for any size, any corner radius, a pill or a full circle, and a sticker turned on the page. Each sticker is one Tab stop, after any link of its own front: Enter or Space peels it and lays it back. Under reduced motion there is no fold, the corner is a plain switch between the two faces. Without the script the front is all there is. No library, no canvas, no picture to load.

Updated

Questions

Three custom attributes: data-sticker-peel on a box that hugs the sticker and holds nothing else, data-sticker-peel-front on the element that peels and data-sticker-peel-under on the face that shows underneath. The front decides the size and the stylesheet lays the second face exactly behind it. Settings go on the sticker, for instance data-sticker-peel-beyond="off".

Neither, and no library. The front is the page's own element, cut with a clip-path and never turned into a bitmap, so its text stays sharp on any screen and can be selected at rest. The back, the roll at the fold and the shadow are gradients drawn while the sticker is lifted.

Yes, with data-sticker-peel-beyond. A release past threshold, half the sticker by default, lays it back down with back, the default, keeps it peeled with hold, or lets it come off and fall away with off. From JavaScript, peel(amount, place) peels it by itself and holds, stick() lays it back and off() takes it off.

Yes, on both faces. A press on a corner that did not travel more than a few pixels is handed to the front as a click, so a link or a button on the front works. The face underneath is the page's own element too, and can be clicked and read as soon as it shows.

It takes any shape a border-radius makes, a pill or a full circle included, and a sticker turned on the page. A finger on a corner peels, and a finger anywhere else on the sticker scrolls the page as usual. Each sticker is one Tab stop: Enter or Space peels it open, the same key lays it back, and Escape lays a held sticker back.