Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Allow media query settings for offset amount + more #17

Open
tw2113 opened this issue Jan 17, 2018 · 6 comments
Open
Milestone

Comments

@tw2113
Copy link
Member

tw2113 commented Jan 17, 2018

Context of the problem: One of the commonest uses of this plugin will be to offset same-page hyperlink jumps due to a fixed menu bar at the top which needs to be compensated for, or else the anchored content will appear behind the fixed menu bar.

Because the fixed menu itself is often responsive, its height will vary (one-line menu bar becomes two lines for smaller screens), and therefore the hash link scroll offset will need to vary accordingly also.

Some websites also disable the fixed menu for mobile screens, and in that case, the hash link scroll offset should be disabled for mobile screens.

Suggested solution (manually determine offset conditions): Please add a feature which allows media queries to be added to vary the offset amount (px) according to screen width. It should be possible to add as many media queries as needed.

Extended solution (automatically determine offset conditions): Even better if you could allow users to link the offset value (px) to the height of fixed menu bar in question, by adding a plugin setting field in which users can specify the class or id of the <div> that represents the fixed menu. That way, the offset can be automatically determined by the height of the fixed menu.

@agg2
Copy link

agg2 commented Jan 17, 2018

Thank you - just a formatting error I would like to point out in your post - at some point in my text which you have copied and pasted, the word "<div>" appears and was not formatted/rendered correctly - it was simply omitted and a gap appears. I've indicated in red where this happens in the screenshot below. I was going to suggest just enclose with back quotes so that it appears as <div> or replace it with "html element" or something.

Image of formatting error

@tw2113
Copy link
Member Author

tw2113 commented Jan 17, 2018

Thanks for that. Fixed and code quoted so it won't be missed.

@agg2
Copy link

agg2 commented Feb 21, 2018

*bump

Still interested in this feature and watching intently. Please don't forget about this request. :)

@tw2113
Copy link
Member Author

tw2113 commented Feb 21, 2018

It's not forgotten as a whole, but I must admit we also don't have anyone actively working on the plugin at the moment either, as it's not presently a high priority item.

@tw2113
Copy link
Member Author

tw2113 commented Apr 18, 2022

Alternative ideas here, after recent forum support requests.

Provide an option to specify a selector, say #nav or similar, and on clicks, get the current height of that markup and run the calculations. This is in part from a page on desktop that as you scrolled, a fixed header area condensed down by 30px and was not getting recalculated at all.

@tw2113
Copy link
Member Author

tw2113 commented May 24, 2022

@tw2113 tw2113 added this to the 1.0.0 milestone Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants