{"_id":"elevator.js","_rev":"6-a2c83374cb506517cd869adb3d8b2522","name":"elevator.js","description":"Elevator.js fixes those awkward \"scroll to top\" moments the old fashioned way.","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"elevator.js","version":"1.0.0","description":"Elevator.js fixes those awkward \"scroll to top\" moments the old fashioned way.","main":"elevator.min.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/tholman/elevator.js.git"},"keywords":["Elevator","Easter Egg"],"author":{"name":"Tim Holman","email":"timothy.w.holman@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/tholman/elevator.js/issues"},"homepage":"https://github.com/tholman/elevator.js#readme","gitHead":"a558ef5c797d84fc318cbed3e48a86342b699485","_id":"elevator.js@1.0.0","_shasum":"c1e03c5d8ba6983a9297f2006c189a5851d293b7","_from":".","_npmVersion":"3.3.9","_nodeVersion":"5.0.0","_npmUser":{"name":"tholman","email":"timothy.w.holman@gmail.com"},"dist":{"shasum":"c1e03c5d8ba6983a9297f2006c189a5851d293b7","tarball":"https://registry.npmjs.org/elevator.js/-/elevator.js-1.0.0.tgz","integrity":"sha512-jwidco71LRDbO4LVwpQNRAMAlEmVxlCEV+Arhyassa2mnwm3kYPoJDR7/tkzO9SjcIckOE6HjlEbswFVi2Yahw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDAbZ+CioUHvdRP5T0LbZ3UL0omPNB7qwkpfqANXTGCLQIhAO7Q6Dcg2qA3jR4CLIRUWYYqBARkTsX2j9CRc4u8AYwv"}]},"maintainers":[{"name":"tholman","email":"timothy.w.holman@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/elevator.js-1.0.0.tgz_1469544859335_0.41848331573419273"}},"1.0.1":{"name":"elevator.js","version":"1.0.1","description":"Elevator.js fixes those awkward \"scroll to top\" moments the old fashioned way.","keywords":["scroll","top","elevator"],"homepage":"http://tholman.com/elevator.js","bugs":{"url":"https://github.com/tholman/elevator.js/issues"},"license":"MIT","author":{"name":"Tim Holman","email":"timothy.w.holman@gmail.com","url":"http://tholman.com"},"main":"elevator.min.js","repository":{"type":"git","url":"git+https://github.com/tholman/elevator.js.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"gitHead":"c19ae9ec39ccb40876c50fc306e837cee2e82dc4","_id":"elevator.js@1.0.1","_npmVersion":"5.3.0","_nodeVersion":"8.6.0","_npmUser":{"name":"tholman","email":"timothy.w.holman@gmail.com"},"dist":{"integrity":"sha512-3+jUQIrUxDGjhF7cyrxi+NcqaDkYhQ+Y2UfVqozYMLxAY1i9l2ZjLWzPlFMFc4nx3SPYf9EPHEn1zUqpIWlXng==","shasum":"97ebb45db5093cbadeb0a307bb40cc8264673d8c","tarball":"https://registry.npmjs.org/elevator.js/-/elevator.js-1.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICDjzeGKDDl30lPHvAHWS+T8QaWOxrxxS/myh6UKXWx7AiBRPyoWgunsUZj7st0F2skqO3K+B1K3wkBNjwO5cCYrIw=="}]},"maintainers":[{"name":"tholman","email":"timothy.w.holman@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/elevator.js-1.0.1.tgz_1507661932319_0.16453976603224874"}}},"readme":"# elevator.js\nFinally, a \"back to top\" button that behaves like a real elevator, by adding elevator music to quietly soothe the awkwardness that can ensue when being smoothly scrolled to the top of the screen.\n\nThis is very serious stuff, [here's a demo](http://tholman.com/elevator.js)!\n\n### Instructions\n\n`Elevator.js` is a stand alone library (no jquery, or the likes) so usage is pretty straight forward. All styling of elements is up to you. `Elevator.js` only handles the audio management, and the scroll functionality!\n\n#### JS\n\n`Elevator.js` lives entirely within the js realm, which makes things fairly simple to use.\n\nYou'll need to create a new instance of `Elevator`, and pass it some audio elements.\n\n```html\n<script>\n// Elevator script included on the page, already.\n\nwindow.onload = function() {\n  var elevator = new Elevator({\n    mainAudio: '/src/to/audio.mp3',\n    endAudio: '/src/to/end-audio.mp3'\n  });\n}\n\n// You can run the elevator, by calling.\nelevator.elevate();\n</script>\n```\n\nYou can also add an \"element\" option, clicking this element will invoke the \"Scroll to top\" functionality, we all love and crave.\n```html\n<div class=\"elevator-button\">Back to Top</div>\n\n<script>\n// Elevator script included on the page, already.\n\nwindow.onload = function() {\n  var elevator = new Elevator({\n    element: document.querySelector('.elevator-button'),\n    mainAudio: '/src/to/audio.mp3',\n    endAudio: '/src/to/end-audio.mp3'\n  });\n}\n</script>\n```\n\nIf you don't want to scroll to the top, a custom target can be specified by adding a \"targetElement\" option:\n```html\n<div class=\"elevator-button\">Take the elevator to the target</div>\n\n<script>\n// Elevator script included on the page, already.\n\nwindow.onload = function() {\n  var elevator = new Elevator({\n    element: document.querySelector('.elevator-button'),\n    targetElement: document.querySelector('#elevator-target'),\n    mainAudio: '/src/to/audio.mp3',\n    endAudio: '/src/to/end-audio.mp3'\n  });\n}\n</script>\n```\n\nIf you want to scroll to a point on the page with some extra padding on the top, simply add the \"verticalPadding\" option:\n\n```html\n<div class=\"elevator-button\">Take the elevator to the target</div>\n\n<script>\n// Elevator script included on the page, already.\n\nwindow.onload = function() {\n  var elevator = new Elevator({\n    element: document.querySelector('.elevator-button'),\n    targetElement: document.querySelector('#elevator-target'),\n    verticalPadding: 100,  // in pixels\n    mainAudio: '/src/to/audio.mp3',\n    endAudio: '/src/to/end-audio.mp3'\n  });\n}\n</script>\n```\n\nIf you're really serious (boring), you don't have to use audio... and can also set a fixed time to scroll to the top\n```html\n<div class=\"elevator-button\">Back to Top</div>\n\n<script>\n// Elevator script included on the page, already.\n\nwindow.onload = function() {\n  var elevator = new Elevator({\n    element: document.querySelector('.elevator-button'),\n    duration: 1000 // milliseconds\n  });\n}\n</script>\n```\n\nIf you use elevator.js in combination with other code, you might want to use callbacks\n```html\n<script>\nwindow.onload = function() {\n   new Elevator({\n       element: document.querySelector('.elevator-button'),\n       mainAudio: '/src/to/audio.mp3',\n       endAudio: '/src/to/end-audio.mp3',\n       duration: 5000,\n       startCallback: function() {\n         // is called, when the elevator starts moving\n       },\n       endCallback: function() {\n         // is called, when the elevator reached target level\n       }\n   });\n}\n</script>\n```\n\n### NPM\nThe package is also available via [NPM](https://www.npmjs.com/package/elevator.js)\n\n### License\n\nElevator.js is covered by the MIT License.\n\nAudio in the Demo (sourced from [BenSound](http://www.bensound.com/)) is licenced under [Creative Commons](http://www.bensound.com/licensing).\n\nCopyright (C) 2015 ~ [Tim Holman](http://tholman.com) ~ timothy.w.holman@gmail.com\n","maintainers":[{"name":"tholman","email":"timothy.w.holman@gmail.com"}],"time":{"modified":"2022-06-16T08:39:27.673Z","created":"2016-07-26T14:54:21.635Z","1.0.0":"2016-07-26T14:54:21.635Z","1.0.1":"2017-10-10T18:58:54.130Z"},"homepage":"http://tholman.com/elevator.js","keywords":["scroll","top","elevator"],"repository":{"type":"git","url":"git+https://github.com/tholman/elevator.js.git"},"author":{"name":"Tim Holman","email":"timothy.w.holman@gmail.com","url":"http://tholman.com"},"bugs":{"url":"https://github.com/tholman/elevator.js/issues"},"license":"MIT","readmeFilename":"README.md","users":{"rocket0191":true}}