Offset for fixed header on windows resize.
ltnfernandes opened this issue · 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 ; ) )
+1
It would be very nice if the plugin adapts above suggestion ... is there any chance it will happen?
Second this too. Very needed. Function with a condition, as a parameter, does not work.
Thirdeded :P