Skip to content

Offset for fixed header on windows resize. #31

Description

@ltnfernandes

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions