Scrollify
Scrollify copied to clipboard
Removed JQuery dependency
I wanted to use this on a website I'm building that doesn't have JQuery, so I rewrote the plugin to use vanilla JS.
It's seems to be working fine, and I'm implementing it into my own project right now, however I wondered if you'd like to include my changes in the base repo? There's practically no reason to use JQuery as it takes 100ms to load (on my computer) and nearly everything is achievable without it.
If you do want to use my code, please tell me as I will have to make some changes.
- First off, I use tabs instead of spaces, but I can revert that.
- Secondly, I put my
{on a new line, however I can revert that too. - Thirdly, I couldn't get the animations to be the same when animating it with vanilla JS. I'm not too sure why this is, however there will be a difference both in speed and interpolation when using the new code (however I've gotta say I prefer this version's).
- Fourth, I'm not using NodeJS so I haven't debugged it for that, however I suspect it won't be working for that.
This is an amazing contribution, thank you. I will review your PR and try it out on the example pages. If it's all good, I'll certainly want to merge this in.
One thing to note, as you're using modern JavaScript, we'll need to introduce Babel to transpile this for older browser support.
Ah, ok, hadn't been thinking about that. Would that involve a development file and a production file? I guess that would also mean that we could compress the production file which would be beneficial.
I've given you access to my fork btw if that helps (https://github.com/cyruscook/Scrollify/invitations)
I believe line 917 (if(panel.originalEvent)) is checking if panel is a JQuery event obj? I'm not too sure why that is however, as if I'm not mistaken panel is meant to be either the index or name of a panel. Do you know what that's meant to be for?
Regarding (if(panel.originalEvent)) I think the intention here was to enable something like this:
$('a').click($.scrollify.move)
But I don' think I ever documented this so it's probably not used like that by anyone. Happy for you to remove this.
I've compressed the file and run it through babel. I've fixed a lot of things, but I've added a Known Issues section to the readme. I'm currently in the process of debugging them.
I'm having some trouble currently, could you help me?
When offset is called on page load, it returns incorrect values, which is why the page snaps. If you check the array heights, its been populated with these incorrect heights. For some reason though, it seems that running the function again makes it work - I'm guessing if this is a problem with the page not fully loading yet?
@cyruscook I'll take a look into that