Skip to content

Conversation

Antonio-Laguna
Copy link
Collaborator

Adding new option to TOC ( addBottomPadding ) which receives a jQuery selector.
When an element is clicked, TOC will check wether there is enough space on the document / window for the target to be positioned at the top of the screen. If there is not, it will add the padding it needs to do it.

Fixes #38

Adding new option to TOC ( `addBottomPadding` ) which receives a jQuery selector.
When an element is clicked, TOC will check wether there is enough space on the document / window for the target to be positioned at the top of the screen. If there is not, it will add the padding it needs to do it.
@jgallen23
Copy link
Owner

I wonder if we should just default the value to 'body'. I guess that might break some sites if we add padding to the bottom of the body. thoughts?

@Antonio-Laguna
Copy link
Collaborator Author

I thought the same but maybe we can just use true if the option is set to true in which case it's up to the developer to leave that as is.

@jgallen23
Copy link
Owner

so true will add padding to body?

@Antonio-Laguna
Copy link
Collaborator Author

Yep, that's my suggestion but that's not what's implemented. Should I proceed?

@jgallen23
Copy link
Owner

lets leave it as false for now and then we can always change later

@jgallen23
Copy link
Owner

every time I click on a link, the bottom padding grows.

screen shot 2014-06-17 at 1 51 46 pm

Commenting test which won't work on PhantomJS
Updating logic since it was grabbing an incorrect element. Padding is now being changed when needed and calculating increments so we don't see any jumps.
@jgallen23
Copy link
Owner

found another issue. In the example, if I click the last item and then click the second to last, the smooth scrolling is a little off. Not sure the best way to handle this. Also, can you merge in from master?

@jgallen23
Copy link
Owner

make sure you remove the margin-bottom: 1000px and add the addBottomPadding to the plugin in the example

@Antonio-Laguna
Copy link
Collaborator Author

This should now be fixed. I made removing the padding in the case it's less than the previous one an operation to be done after scrolling so you don't notice a jumpiness.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

option to add spacing on the bottom of the page so that when clicking on an item, it always shows up at the top

2 participants