cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <div id="button-background">
	<span class="slide-text">Swipe</span>
	<div id="slider">
		<i id="locker" class="material-icons">lock_open</i>
<div class="bottom">Coded by <a href="https://github.com/gpressutto5">Guilherme Pressutto</a>. Designed by <a href="https://dribbble.com/diegomartins">Diego Martins</a>.</div>

              $bgColor: #3a3d55;
$slideBgColor: rgba(255,255,255,0.3);
$slideBallColor: white;
$slideBallIconColor: black;
$slideTextColor: #3a3d55;

@mixin center {
  display: flex;
  align-items: center;
  justify-content: center;

@mixin nonselect {
	-webkit-touch-callout: none;
    -webkit-user-select: none;
     -khtml-user-select: none;
       -moz-user-select: none;
        -ms-user-select: none;
            user-select: none;
	cursor: default;

html, body {
	height: 100%;
	overflow: hidden;

body {
	background-color: $bgColor;
	@include center;

#button-background {
	position: relative;
	background-color: $slideBgColor;
	width: 400px;
	height: 80px;
	border: white;
	border-radius: 40px;
  @include center;

#slider {
	transition: width 0.3s,
		border-radius 0.3s,
		height 0.3s;
	position: absolute;
	left: -10px;
	background-color: $slideBallColor;
	width: 100px;
	height: 100px;
	border-radius: 50%;
	@include center;
	&.unlocked {
		transition: all 0.3s;
		width: inherit;
		left: 0 !important;
		height: inherit;
		border-radius: inherit;

.material-icons {
	color: $slideBallIconColor;
	font-size: 50px;
	@include nonselect;

.slide-text {
	color: $slideTextColor;
	font-size: 24px;
	text-transform: uppercase;
	font-family: 'Roboto', sans-serif;
	@include nonselect;

.bottom {
	position: fixed;
	bottom: 0;
	font-size: 14px;
	color: white;
	a {
		color: white;

              var initialMouse = 0;
var slideMovementTotal = 0;
var mouseIsDown = false;
var slider = $('#slider');

slider.on('mousedown touchstart', function(event){
	mouseIsDown = true;
	slideMovementTotal = $('#button-background').width() - $(this).width() + 10;
	initialMouse = event.clientX || event.originalEvent.touches[0].pageX;

$(document.body, '#slider').on('mouseup touchend', function (event) {
	if (!mouseIsDown)
	mouseIsDown = false;
	var currentMouse = event.clientX || event.changedTouches[0].pageX;
	var relativeMouse = currentMouse - initialMouse;

	if (relativeMouse < slideMovementTotal) {
		$('.slide-text').fadeTo(300, 1);
			left: "-10px"
		}, 300);
		slider.on('click tap', function(event){
			if (!slider.hasClass('unlocked'))
			slider.off('click tap');
	}, 0);

$(document.body).on('mousemove touchmove', function(event){
	if (!mouseIsDown)

	var currentMouse = event.clientX || event.originalEvent.touches[0].pageX;
	var relativeMouse = currentMouse - initialMouse;
	var slidePercent = 1 - (relativeMouse / slideMovementTotal);
	$('.slide-text').fadeTo(0, slidePercent);

	if (relativeMouse <= 0) {
		slider.css({'left': '-10px'});
	if (relativeMouse >= slideMovementTotal + 10) {
		slider.css({'left': slideMovementTotal + 'px'});
	slider.css({'left': relativeMouse - 10});

Loading ..................