rstacruz / flatdoc

Build sites fast from Markdown
http://ricostacruz.com/flatdoc
2.68k stars 262 forks source link

Issues with Markdown and images #31

Closed Kikobeats closed 9 years ago

Kikobeats commented 10 years ago

Hello!

I have detected a problem when the markdown file have images: The navbar active tab don't work fine because haven't in consideration the space of the images.

Normally active navbar section is different than the section that you are watching.

You can see a demo of this in the following link > http://server-dummies.herokuapp.com

rstacruz commented 10 years ago

The heroku app you posted doesn't exist anymore.

Anyway, the navbar can't always highlight the correct headline, unfortunately this is by design. It highlights whatever is in the sorta center of the viewport, which can sometimes be off around the end of a document, or when some sections are smaller than others. This doesn't have anything to do with images.

UziTech commented 10 years ago

Actually it does have to do with images.

I have a page that, according to the nav bar, is on the last section when the header of the last section is actually about 1000px below the bottom of the page.

If I remove the images the nav bar is correct

UziTech commented 10 years ago

It looks like the issue is in theme-white/script.js. The $.fn.scrollagent collects the offsets of the section headers before the images load.

Since the element is also saved in offsets.el, is there a reason you don't just look at offset.el.offsetTop instead of the saved value in offset.top?

rstacruz commented 9 years ago

@UziTech's fix will land in 0.9.0 shortly. thanks!