lukehaas / Scrollify

A jQuery plugin that assists scrolling and snaps to sections.
MIT License
1.8k stars 579 forks source link

Offset mobile vs desktop #320

Open Clomez opened 6 years ago

Clomez commented 6 years ago

Hi,

Great plugin But i have a small problem.

I can set offset for scrollify, but any value dosent quite seem to work on both mobile, and on desktop.. if i do offset -100 desktop will be fine, but mobile will literally snap between sections...

and with offset 0, all the desktop screens casually scroll every other section waaay past screen. usually at least Title and 3-5 rows off text end up above the screen...

Also the snapping section seems to differ from one section to next one, on both desktop and phone. one title will be few inches from top, and next will go way above the screen, event tho all the sections are identical.

One solution would be to do different offset per screen width, but that seems suicidal on long term.

Thank you!

$(function() { $.scrollify({ section : ".section", sectionName: "section-name", scrollSpeed: 2000, standardScrollElements: ".scrolls", offset : 0, setHeights: false, scrollbars: true, overflowScroll: true, before:function(i, val) { .... code omitted }, after:function(i, val){ .... code omitted }, });

});