jankyscroll 2.0
A Javascript scrolling plugin that doesn't need to exist.
Welcome to jankyscroll
Jankyscroll makes your website's UX undeniably worse. Let's talk about a couple ways you could delude yourself into thinking that you want this.
-
First and foremost, jankyscroll is a tool for randomized, organic content discovery. Users can unintentionally (and forcibly!) discover parts of your website they didn't know or care about, and probably still won't. Maybe that's something you want. I don't know.
-
In today's diverse ecosystem, it can be a real challenge to support every available platform. Solutions like Modernizr do their best to help you adapt to all manner of devices, but jankyscroll elegantly handles everything for you: performance will be just as terrible on a brand new, state-of-the-art machine as it was on your dad's old Compaq that caught fire.
-
For too long, content providers have allowed ungrateful users to scroll wherever they please, whenever they please. With jankyscroll, you can assert your rightful dominance as a Provider of Value, and stop those thankless users from scrolling so freely. Control the Scroll, with jankyscroll. It sucks.
How to use jankyscroll
If you really want to use jankyscroll, I guess I can't stop you. First, you would include it in your page, like this. You should probably already know this stuff.
<script src="your/path/to/jankyscroll.js"></script>
Then, initialize the plugin at the bottom of your document, if you're a good programmer who follows best practices. Which you're obviously not, given you're here.
jankyscroll(trigger_distance, jank_amount);
trigger_distance
sets the distance, in pixels, that one has to scroll before they get jank'd. jank_amount
sets an approximate range of just how jank'd they'll get, also in pixels.
jankyscroll(400, 50);
For instance, the above code would mean that the user would be jank'd around by about 50px for every 400px scrolled.
Thankfully, that's all. If your jank_amount
is greater than your trigger_distance
, that might cause some problems. Who cares.
jankyscroll 2.0
In order to surface powerful emergent janking patterns, we've made some changes in our version jump to jankyscroll 2.0. We've added a third argument, jank_method
, specifying a specific method of janking. Here are three provided stock options:
"scroll"
(default) - The classic flavor of jank "enjoyed" by web users all around the globe."offset"
- Sorry, I don't remember what this one does."hardcore"
- This option is for hardcore jank junkies only. Be warned, this will jank each element separately.
Exmaple useage:
jankyscroll(400, 250, "hardcore");
If you wish, you can supply a custom jank function. Your function should take an integer value called jank_amount
. Creating your own jank function allows for incredible extensibility. Here's sideways janking:
jankyscroll(320, 160, function(jank_amount) { window.scrollBy(jank_amount, 0); // x, y });
Sick.
Support or Contact
Having trouble with jankyscroll? Sorry, I don't really know what to do about that. It's trouble to begin with, no? I'm sure you'll figure it out.
If you'd like to contact me about jankyscroll: please, don't.
It doesn't work on mobile. If someone wants to submit a PR to make that happen, I'll probably laugh at you for wasting your time on this bullshit and then accept it. So, you know, go for it.
Nevermind, it totally does work on mobile. Please don't bamboozle me like this.
Acknowledgements
I snatched the starting point for this venture from The Onion's fartscroll.js, which I whole-heartedly encourage you use alongside jankyscroll.
I'd like to publically shame James Adam Buckland for encouraging this.
License
Copyright (c) 2015 Benjamin Zweig
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.