CodePen thumbnail tool

Click here for more info...

CodePen thumbnail tool

A set of tools to help detect when your pen is being shown in a thumbnail view and simulate mouse movement.

As an example, the content of this pen looks different in its preview thumbnail and the cursor circle moves automatically. See here.

Please keep in the spirit of CodePen. Don't use this tool to show something completely different, click baity or disingenuous in the thumbnail preview.

How to use

Simply add this CodePen pen to your CodePen pen. Pen.

In other words - When you're in your pen's editor, click the setting button top right, select the javascript tab and paste in this link as an external script...

https://codepen.io/ste-vg/pen/xeZOMK

JS

There is a CodePen object available in JS so you can check if the pen is in a thumbnail/preview window.

CSS

Body class

The output from the CodePen.view gets automatically added as a class to the body.

Custom Properties

The CodePen thumbnail tool also sets some custom properties that allows you to hide or show content.