scrollIt.js icon indicating copy to clipboard operation
scrollIt.js copied to clipboard

Offset for fixed header on windows resize.

Open ltnfernandes opened this issue 11 years ago • 3 comments

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 ; ) )

ltnfernandes avatar Mar 27 '14 11:03 ltnfernandes

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

joopvos avatar Jun 01 '14 20:06 joopvos

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

andreyshipilov avatar Oct 27 '14 00:10 andreyshipilov

Thirdeded :P

ghost avatar Mar 04 '16 19:03 ghost