Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
doctype html
html
  head
    script(src="http://code.jquery.com/jquery-2.1.0.min.js")
  body
    - for (var i = 0; i < 10; i++)
      .box
 
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box
}
html, body {
  height: 100%
}
.box {
  height: 100%;
  border-bottom: 1px solid
}
 
statu = true
$win = $ window
$doc = $ document
winHeight = $win.height()
docHeight = $doc.height()
getIndex = (num)->
  index = 0 ^ num / winHeight
toIndex = (index, ms)->
  height = index * winHeight
  ms = ms || 0
  $('html, body').animate scrollTop : height, ms, -> statu = true
$win.on 'mousewheel', (event)->
  delta = event.originalEvent.wheelDelta or -event.originalEvent.detail
  docScrollTop = $doc.scrollTop()
  index = getIndex(docScrollTop)
  if delta <= 0
    index += 1
  else
    index -= 1
  if statu == true
    statu = false
    toIndex(index, 500)
  event.preventDefault()
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers