cmpolis / scrollIt.js

A jQuery plugin that makes it easy to create paginated, feature vertically scrolling pages.
http://bytemuse.com/scrollIt.js
Other
539 stars 148 forks source link

Offset for fixed header on windows resize. #31

Open ltnfernandes opened 10 years ago

ltnfernandes commented 10 years ago

Hi,

Your plugin works great. It is simple, have only basic functionality (which i like) and works with "data-" attributes.

Just have a single note/question?

I am building responsive sites (i believe this is a "must" or it will become shortly), so it would be nice if this plugin could adapt to this. I have test in 4/5 mobile devices and it works great. But one thing i notice is when you have a fixed header/menu. When resizing the browser window, the "topOffset" option no more corresponds to the real height of the header/menu, leaving a big space when window gets smaller and an elements overlap when window gets bigger. Obviously this is because we are setting "topOffset" with fixed pixels.

I ended up "extending" your plugin. Added option "fixedHeaderClass" and attached window resize event to plugin:

$(window).resize(function(){ settings.topOffset = - ($("."+settings.fixedHeaderClass).height());
});

Don´t know if this is the best way (not much time to check your code).

It would be nice if your plugin could respond better to window resize ; )

Regards.

(once more, great work ; ) )

joopvos commented 10 years ago

+1 It would be very nice if the plugin adapts above suggestion ... is there any chance it will happen?

andreyshipilov commented 10 years ago

Second this too. Very needed. Function with a condition, as a parameter, does not work.

ghost commented 8 years ago

Thirdeded :P