-
Notifications
You must be signed in to change notification settings - Fork 501
Offset from top #87
Comments
Hi, This does not work for my use case. My content is dynamically generated by the user using a content builder, so I can't just put paddings on all the elements because they don't have consistent classes. Any other workaround? Even hacky ones accepted. |
Got a link? |
Not live at the moment. I ended up modifying the source to hard-code an offset, on row 205:
Seems to work fine without any additional options. |
I just ran into this issue as well with 3.0. |
Same reason I did it - sometimes your HTML is not setup in a way to allow for the padding / negative margin trick, and it's unnecessary to write a wad of markup/CSS when the solution is so simple. |
@davist11 btw, thanks for this awesome plugin, I am having a lot of fun integrating it with a new Drupal 8 site I'm creating. |
@khromov Thank you! |
As I am using this in one page navigation I have to have some space in each container (offset). But I got not configuration to do that. It was working with 2.00 version. I need it in this version. Can anybody please let me know if there any way to offset container while jQuery-One-Page-Nav activate? |
@codergens can you clarify what you mean? |
Changed line 205 from scrollTop: offset to scrollTop: (offset - this.config.scrollOffset) and added var top_offset = $('header.navbar').height() - 1; // get height of fixed navbar
$('.active-parent .dropdown ul').onePageNav({
currentClass: 'current',
changeHash: false,
scrollSpeed: 500,
scrollOffset: top_offset,
scrollThreshold: 0.5,
filter: '',
easing: 'swing',
begin: function() {
//I get fired when the animation is starting
},
end: function() {
//I get fired when the animation is ending
},
scrollChange: function($currentListItem) {
//I get fired when you enter a section and I pass the list item of the section
}
}); @davist11 Really nice plugin, afaik it must be the most used drop-in solution for One Page Navs. |
There used to be a scrollOffset, but it was removed in favor of a CSS only solution. http://davist11.github.io/jQuery-One-Page-Nav/top.html |
Yeah I used that, but ran into problems because the paddings of the sections with IDs in my current project are of dynamic/different size for each section. Was there a problem with the |
👍 on @cseelus suggestions. Since I opened the ticket, I have used this plugin with scrollOffset on multiple sites without any issues. Why not just make it an optional config flag and most people won't use it, but those who need it will. :) |
The padding/margin solution has no affect on the spacing of the actual section. If you use scrollOffset and changeHash, it doesn't work because when you change the hash, you get moved down directly to the section, so that's why it was removed. |
@davist11 That's true, but some people don't use changeHash. The padding/margin method is not very user-friendly - it forces users to change markup for the sake of this plugin instead of being "plug and play". |
Any way we can get a backport of the feature to work in 3.0.0? So that when you click a link there is some offset to the top of the screen to account for absolute positioned top menu.
Or, can we get an example of the "negative top margin" trick mentioned here: #83 ?
I think even though the feature doesn't work with all options, it should still be available with a warning.
The text was updated successfully, but these errors were encountered: