Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="scrollSnapDotsClip">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>scrollSnapDotsClip</title>
</head>
<body>
  <div class="footer">
    <a href="#p1" class="faint"></a>
    <a href="#p2" class="faint"></a>
    <a href="#p3" class="faint"></a>
    <a href="#p4" class="faint"></a>
    <a href="#p5" class="faint"></a>
  </div>
  <div class="app">
    <div class="pages">
      <div id="p1" class="page">
        <div class="foot">
          <div class="dot">
            <div class="dot-inner">
              <div class="dot-val"></div>
            </div>
          </div>
        </div>
      </div>
      <div id="p2" class="page">
        <div class="foot">
          <div class="dot">
            <div class="dot-inner">
              <div class="dot-val"></div>
            </div>
          </div>
        </div>
      </div>
      <div id="p3" class="page">
        <div class="foot">
          <div class="dot">
            <div class="dot-inner">
              <div class="dot-val"></div>
            </div>
          </div>
        </div>
      </div>
      <div id="p4" class="page">
        <div class="foot">
          <div class="dot">
            <div class="dot-inner">
              <div class="dot-val"></div>
            </div>
          </div>
        </div>
      </div>
      <div id="p5" class="page">
        <div class="foot">
          <div class="dot">
            <div class="dot-inner">
              <div class="dot-val"></div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</body>
</html>
 
@import url('https://necolas.github.io/normalize.css/3.0.2/normalize.css');
html {
  box-sizing: border-box;
  background: #fff;
}
*,
*::before,
*::after {
  box-sizing: inherit;
}
.app {
  position: absolute;
  top: 0;
  right: 0;
  height: 90vh;
  left: 0;
  
  pointer-events: none;
  
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  -webkit-scroll-snap-type: mandatory;
  scroll-snap-type: mandatory;
  -webkit-scroll-snap-destination: 50% 50%;
  scroll-snap-destination: 50% 50%;
  
  display: flex;
  display: -webkit-flex;
  flex-flow: column;
  -webkit-flex-flow: column;
}
.pages {
  flex: 0 0 auto;
  display: flex;
  display: -webkit-flex;
  flex-flow: row;
  -webkit-flex-flow: row;
  height: 80vh;
}
.page {
  position: relative;
  width: 100vw;
  background: url('http://placekitten.com/300/700') no-repeat center;
  background-size: cover;
  height: 100%;
  
  pointer-events: auto;
  
  -webkit-scroll-snap-coordinate: 50% 50%;
  scroll-snap-coordinate: 50% 50%;
  
  flex: 0 0 auto;
  -webkit-flex: 0 0 auto;
  
  &:nth-child(1) {}
  &:nth-child(2) {background-image: url('http://placekitten.com/600/800');}
  &:nth-child(3) {background-image: url('http://placekitten.com/600/850');}
  &:nth-child(4) {background-image: url('http://placekitten.com/600/900');}
  &:nth-child(5) {background-image: url('http://placekitten.com/600/950');}
}
.footer {
  position: fixed;
  top: 80vh;
  width: 100%;
  left: 0;
  flex: 0 0 auto;
  -webkit-flex: 0 0 auto;
  height: 10vh;
  
  display: flex;
  display: -webkit-flex;
  flex-flow: row;
  -webkit-flex-flow: row;
  align-items: center;
  -webkit-align-items: center;
  justify-content: center;
  -webkit-justify-content: center;
}
.faint {
  background: #ddd;
  border-radius: 100%;
  height: 2vh;
  width: 2vh;
  margin: 0 1vh;
}
.foot {
  width: 100%;
  position: absolute;
  top: 100%;
  height: 10vh;
  display: flex;
  display: -webkit-flex;
  align-items: center;
  -webkit-align-content: center;
  justify-content: center;
  -webkit-justify-content: center;
  
  pointer-events: none;
}
.dot {
  position: relative;
  height: 100%;
  width: 100%;
}
.dot-inner {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  clip: rect(auto, auto, auto, auto);
}
.dot-val {
  position: fixed;
  left: 0;
  right: 0;
  top: 80vh;
  height: 10vh;
  
  
  display: flex;
  display: -webkit-flex;
  justify-content: center;
  -webkit-justify-content: center;
  
  &::after {
    content: '';
    width: 2vh;
    height: 2vh;
    margin-top: 4vh;
    background: #f00;
    display: block;
    border-radius: 100%;
    
    .page:nth-child(1) & { margin-right: 16vh; }
    .page:nth-child(2) & { margin-right: 8vh; }
    .page:nth-child(3) & {  }
    .page:nth-child(4) & { margin-left: 8vh; }
    .page:nth-child(5) & { margin-left: 16vh; }
  }
}
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers