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

Adding new option #42

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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
2 participants