jgallen23 / toc

Table of Contents Plugin
http://projects.jga.me/toc/
MIT License
531 stars 111 forks source link

Adding new option #42

Open Antonio-Laguna opened 10 years ago

Antonio-Laguna commented 10 years ago

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

jgallen23 commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

so true will add padding to body?

Antonio-Laguna commented 10 years ago

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

jgallen23 commented 10 years ago

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

jgallen23 commented 10 years ago

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

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

jgallen23 commented 10 years ago

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 commented 10 years ago

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

Antonio-Laguna commented 10 years ago

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.