juanbrujo / jQuery-Timelinr

Dando vida al tiempo / Giving life to time
261 stars 106 forks source link

Error when datesDiv or issuesDiv don't exist on page #12

Closed kevindb closed 8 years ago

kevindb commented 9 years ago

If Timelinr is included on a page that does not intend to use the library (for example, the lib is concatenated into a minified site-wide JS file), it throws an error when trying to calculate the defaultPositionDates from the sizes of non-existent DOM elements.

I will submit a pull request that allows Timelinr to fail more gracefully in this situation.

juanbrujo commented 9 years ago

OK I'll have to test this, thanks @kevindb

kevindb commented 9 years ago

The default diff looks like I changed a lot, but if you ignore whitespace, it was only three lines. I really just added an 'if' on line 36 and indented all the code inside the if. https://github.com/kevindb/jQuery-Timelinr/commit/1f53e6625a5e1b6006c17679a7c9b78f7d9e47f3?w=1

Thanks for checking it out!