Skip to content

Instantly share code, notes, and snippets.

@davismj
Created March 31, 2021 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davismj/e2ff0f57d93e8cbe4028fa1c68491f94 to your computer and use it in GitHub Desktop.
Save davismj/e2ff0f57d93e8cbe4028fa1c68491f94 to your computer and use it in GitHub Desktop.
Challenge: Scrollbar Method
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
.container {
position: relative;
overflow: hidden;
max-height: 100vh;
max-width: 100vw;
padding: 0;
}
.big-content {
width: 200vw;
height: 100vh;
background: linear-gradient(90deg, black, white);
}
.scrollbar {
position: fixed;
background: white;
}
.vertical {
height: 100%;
width: 2rem;
right: 0;
}
.horizontal {
width: 100%;
height: 2rem;
bottom: 0;
}
.scrollbar .handle {
background: skyblue;
height: 2rem;
width: 2rem;
}
<template>
<link rel="stylesheet" href="app.css" />
<div element.ref="$container" class="container">
<div class="big-content"></div>
<div element.ref="$scrollbar" class="scrollbar horizontal">
<div element.ref="$handle" class="handle" mousedown.delegate="handleMousedown($event)"></div>
</div>
</div>
</template>
export class App {
$container;
$handle;
$scrollbar;
handleMousedown = (event) => { };
handleMousemove = (event) => { };
handleMouseup = (event) => { };
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>
<body aurelia-app>
<h1>Loading...</h1>
<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script>
<script>
require(['aurelia-bootstrapper']);
</script>
</body>
</html>
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-validation');
aurelia.start().then(() => aurelia.setRoot());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment