Skip to content

Instantly share code, notes, and snippets.

@caseypugh
Created August 25, 2014 22:32
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 caseypugh/03f8e27945fd945db54d to your computer and use it in GitHub Desktop.
Save caseypugh/03f8e27945fd945db54d to your computer and use it in GitHub Desktop.
Package scrolling bg select
var total_height = 2000
var container_height = 300
var package_height = 35
var container_ypos = 0 // starting at top
// value between 0 and 1
var scrollbar_pos = container_ypos / (total_height - container_height)
var selected_package = Math.floor(container_ypos + (container_height * scrollbar_pos)) / package_height)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment