Skip to content

Commit 38a3b44

Browse files
authored
v2.0.5.1 - Various bug fixes, changes, new additions and deprecations (#11)
* Update changelog.md * Deleted unnecessary development console log. Deleted unnecessary development console log in the goTo method. * Added a removed note on a new version * Fixed a bug with preventDefault with the pause button - Fixed a bug that when triggering a fake click on the autoplay pause button, it would spit out the error ** Cannot read property 'preventDefault' of undefined** I believe this was due to the fact the `event` wasn't passed to the `.on` function, therefore the plugin didn't understand the code. Fixed by adding the `event` in to the functions (Line 619 and 636) - The `.on` function relating to that of the timeline navigation was inadvertently being run when the pause/play buttons were clicked or triggered. Fixed by adding a `:not` CSS selector to exclude the buttons. (Line 619) - The pause/play `.on` function (`changeButtons`) would now refresh the page, so fixed by adding `event.preventDefault();` (Line 816) * Added some new bug fixtures relating to the pause button preventDefault bug * Added a known issues that won't be fixed section and added the current version * Update To Do.md * Create Version * Rename To Do.md to To_Do.md * Added Version number * Update horizontal_timeline.2.0.min.css * Added deprecated items * Update README.md * Deprecated options, added object options and changed code to reflect this - Deprecated several singular options. [Lines 37-44 and 75-95] - Introduced new object options instead of the single options. [Lines 46-59 and 98-125] - Combined the `animationClass` object into one nested object. - Changed the jQuery options `$.extend` to deep nested recursion with the `true` boolean. Enables the possibility of deep nested objects in the options. [Line 138] - Added a way to internally access the user options. [Line 141] - Changed various code to check if the new object options is set in the user options, if so use them, otherwise use the deprecated single options. [Lines 183-189, 285-307, 902-909, 1578-1582, 1629-1633 and 1758-1770] * changed indentation * Update horizontal_timeline.2.0.js * Update changelog.md * added a known issue * Added new changed, fixed and added notes * Changes, Bug fixes and new DOM event. - Changed the internal function structure to a prototype object of functions, so it only adds the functions to the prototype once. - Changed the anonymous functions of `init.addIdsAndClasses`, `create.date`, `create.eventDateDisplay`, and `autoplay`; and added them to the timeline prototype as separate functions `_addIdsAndClasses`, `_createDate`, `_eventDateDisplay`, `_autoplay`. - Fixed an issue with the autoplay pause and play functions, that wouldn't get the instance correctly. - Changed the `create` function to put together the HTML in a variable before adding to the document, avoiding the obsessive use of the jQuery `.append()`. - Fixed a bug where the new autoplay prototype function would throw an error when the autoplay `isPaused` and `mouseEvent` data is being set to the element data object because the data object wasn't created at that point (throwing an `undefined` error). Solved by adding it in the plugin wrapper instead of the internal function. - Fixed a bug with the goTo timeline links where if any of the data options were omitted from the links, the function didn't utilise the default options. This was caused by inconsistent naming and the name changes that occured wasn't reflected in the variable declarations, thereby throwing an `unrecognised` error. - Added a new DOM event `initialised` to combat the issue of undefined errors when trying to use the any of the public methods straight after the initialisation code. The errors are caused by the `setTimeout` in the init function to delay the code so it gets the correct width, which in turn makes everything else delayed. The DOM event will be fired after this delay, indicating the plugin has truly completed. * Added a comment for the new initialised DOM event * Fixed bug - Fixed a bug where on first load or hard-reload, the page would have 2 scrollbars due to both the `HTML` and `body` having the `overflow-x: hidden` CSS attribute. Fixed by removing the `HTML` from the CSS rule. [Line 15] * Update horizontal_timeline.2.0.min.css * Changed initialised DOM event data Changed the name of the event data `element` to `timelineSelector` of the initialised DOM event, to make it more obvious what is is. Element could refer to any part of the timeline, where as timelineSelector would be more specific. [Line 242 - 246] * Update changelog.md * Update README.md - Added an autoplay note - Updated the options * Update horizontal_timeline.2.0.min.js * Removed the use of tinyMobile and smallTablet Removed the use of `tinyMobile` and `smallTablet` in the media queries and changed the `mobile` and `tablet` query widths to include the missing widths accordingly. * Removed redundant code and changed the default to options to the object options - Removed the use of `tinyMobile` and `smallTablet` in the `checkMQ` function and various if statements due to being redundant (the `mobile` and `tablet` will now cover the missing widths in the CSS media queries). [Lines 811, 1099, 1633, 1852-1857] - Changed the object options code so if no options are defined or both the single and the object options are defined, then it defaults to the new object options, otherwise use the deprecated single options. [Lines 263-275, 297-341, 1678-1699, 1826-1850] * Update horizontal_timeline.2.0.min.css * Rename horizontal_timeline.2.0.js to horizontal_timeline.2.0_v2.0.5.1.js * Rename horizontal_timeline.2.0.min.js to horizontal_timeline.2.0_v2.0.5.1.min.js * Rename horizontal_timeline.2.0.css to horizontal_timeline.2.0_v2.0.5.1.css * Rename horizontal_timeline.2.0.min.css to horizontal_timeline.2.0_v2.0.5.1.min.css
1 parent 5eda70c commit 38a3b44

11 files changed

+2311
-1968
lines changed

JavaScript/horizontal_timeline.2.0.js

Lines changed: 0 additions & 1923 deletions
This file was deleted.

JavaScript/horizontal_timeline.2.0.min.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

JavaScript/horizontal_timeline.2.0_v2.0.5.1.js

Lines changed: 2119 additions & 0 deletions
Large diffs are not rendered by default.

JavaScript/horizontal_timeline.2.0_v2.0.5.1.min.js

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 104 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Horizontal Timeline 2.0
22
#### by [yCodeTech](https://github.com/yCodeTech)
33
#### Twitter [@yCodeTech](https://twitter.com/yCodeTech)
4-
#### Current Version: 2.0.5
5-
Horizontal Timeline 2.0, is a fully customisable jQuery adaptation of a JavaScript plugin originally created by [CodyHouse](http://codyhouse.co/gem/horizontal-timeline/), to create a dynamic timeline on the horizontal axis.
4+
#### Current Version: 2.0.5.1
5+
#### Quick Links: <a href="#setup">Setup</a> | <a href="#options">Options</a> | <a href="#autoplay">Autoplay</a> | <a href="#known-issues">Known Issues</a> | <a href="#known-issues-that-wont-be-fixed">Known Issues That Won't Be Fixed</a> | <a href="#deprecated">Deprecated</a>
6+
7+
Horizontal Timeline 2.0, is a fully customisable jQuery adaptation of a script originally created by [CodyHouse](http://codyhouse.co/gem/horizontal-timeline/), to create a dynamic timeline on the horizontal axis.
68

79
Version 2.0 adds functionality that has been previously requested for the original version, and more:
810
- Transformed into a jQuery plugin, with support for multiple timeline instances utilising ID's.
@@ -13,10 +15,11 @@ Version 2.0 adds functionality that has been previously requested for the origin
1315
- Added new autoplay feature with a progress bar, pause/play buttons, adjustable speed and on-hover pause functionality.
1416
- Added new go-to timeline link with customisable scroll functionality.
1517
- Added support for mouse-wheel scrolling, touch and swipe for touch devices, and keyboard arrow keys, with the option to disable the loading of the required plugin files.
16-
- Added new `refresh`, `destroy`, `addEvent`, `removeEvent`, and `goTo` methods with new attachable namespaced `eventAdded`, `eventRemoved`, `eventChanged`, `goToTimeline` DOM Events.
18+
- Added new `refresh`, `destroy`, `addEvent`, `removeEvent`, and `goTo` methods with new attachable namespaced `initialised`, `eventAdded`, `eventRemoved`, `eventChanged`, `goToTimeline` DOM Events.
1719
- Added new options to change the button icons and to disable the use of the Font Awesome icon library.
1820
- **Deprecated** the use of multiple data attributes, _data-date_ and _data-custom-display_, in favour of the all new combined singular data attribute, _data-horizontal-timeline_, that utilises an object to house all previously-used data.
1921
- Added new animation options to customise the event content animation.
22+
- **Deprecated** some of the individual options in favour of the object options.
2023

2124
For full documentation please check out the [Horizontal Timeline 2.0 website](http://horizontal-timeline.ycodetech.co.uk/)
2225

@@ -76,10 +79,28 @@ $('#example').horizontalTimeline();
7679
/* The Defaults */
7780

7881
$('#example').horizontalTimeline({
82+
// ! Deprecated in favour of the object options. //
7983
desktopDateIntervals: 200, //************\\
8084
tabletDateIntervals: 150, // Minimum: 120 \\
8185
mobileDateIntervals: 120, //****************\\
8286
minimalFirstDateInterval: true,
87+
88+
// ! End Deprecated options //
89+
90+
/* New object options... */
91+
// If the deprecated single options exist in the user options, then use them,
92+
// otherwise default to the new object options.
93+
// Can not use in conjunction with the single options...
94+
// If both single and object options are set in the options, the object will take precedence.
95+
96+
dateIntervals: {
97+
"desktop": 200, //************\\
98+
"tablet": 150, // Minimum: 120 \\
99+
"mobile": 120, //****************\\
100+
"minimal": true
101+
},
102+
103+
/* End new object options */
83104

84105
dateDisplay: "dateTime", // dateTime, date, time, dayMonth, monthYear, year
85106
dateOrder: "normal", // normal, reverse
@@ -95,7 +116,8 @@ $('#example').horizontalTimeline({
95116
useFontAwesomeIcons: true,
96117
useNavBtns: true,
97118
useScrollBtns: true,
98-
119+
120+
// ! Deprecated in favour of the object options. //
99121
iconBaseClass: "fas fa-3x", // Space separated class names
100122
scrollLeft_iconClass: "fa-chevron-circle-left",
101123
scrollRight_iconClass: "fa-chevron-circle-right",
@@ -113,14 +135,91 @@ $('#example').horizontalTimeline({
113135
"left": "exit-left",
114136
"right": "exit-right"
115137
},
138+
// ! End Deprecated options //
139+
140+
/* New object options... */
141+
142+
// If the deprecated single options exist in the user options, then use them,
143+
// otherwise default to the new object options.
144+
145+
// Can not use in conjunction with the single options...
146+
// If both single and object options are set in the options, the object will take precedence.
147+
148+
iconClass: {
149+
"base": "fas fa-3x", // Space separated class names
150+
"scrollLeft": "fa-chevron-circle-left",
151+
"scrollRight": "fa-chevron-circle-right",
152+
"prev": "fa-arrow-circle-left",
153+
"next": "fa-arrow-circle-right",
154+
"pause": "fa-pause-circle",
155+
"play": "fa-play-circle"
156+
},
157+
animationClass: {
158+
"base": "animationSpeed", // Space separated class names,
159+
"enter": {
160+
"left": "enter-left",
161+
"right": "enter-right"
162+
},
163+
"exit": {
164+
"left": "exit-left",
165+
"right": "exit-right"
166+
}
167+
}
168+
169+
/* End new object options */
116170
});
117171
```
118172

119173
[Check out the docs](http://horizontal-timeline.ycodetech.co.uk/).
120174

175+
## Autoplay
176+
The idea of autoplay is that it continuously loops whilst in view, with manual buttons to pause and resume the loop cycle at the user's command. There is no current plans to implement a feature that allows autoplay to stop after a certain amount of loops, due to it conflicting with the sole purpose of autoplay. [[Feature Request](https://github.com/yCodeTech/horizontal-timeline-2.0/issues/10)]
177+
178+
However, there is a workaround that utilises the `eventChanged` DOM event and triggering a click on the pause button. Please check out the codepens:
179+
180+
- [Stop after 1 loop](https://codepen.io/ycodetech/pen/BaNPxzL)
181+
- [Stop after [X] amount of loops](https://codepen.io/ycodetech/pen/YzXMjNo)
182+
183+
184+
121185
## Known Issues
122186

123187
- Autoplay can't be set on multiple timelines, meaning the maximum per page is 1.
124-
- The event content animation can become stuck between classes and glitch out.
188+
- Timeline incorrectly gets and sets the wrong width after creating the HTML. Only happens on load for the first time or hard-reload, with refresh of the timeline or soft-reload seems to rectify the problem. Seems to be related to the navigation buttons not having a width for a few seconds after timeline creation.
189+
190+
A hotfix that was first introduced in v2.0.5-alpha.2 solved the issue with a 300ms `setTimeout` delay in the init function. However, this consequently created errors if a method runs directly after the initialisation code. A workaround was introduced in v2.0.5.1 as the `initialised` DOM event, which would be fired after the delay. If a method needs to be ran directly after the initialisation, use it inside the attachable event. See the [CodePen](https://codepen.io/ycodetech/pen/WNvadbQ). (Not sure how to fix properly.)
125191

126192
These issues are hopefully going to be fixed in the future. If you want to help me out and fix any of these issues yourself, please do so and make a pull request for me to review and merge it with the plugin. All help will be appreciated.
193+
194+
## Known Issues that won't be fixed.
195+
196+
- The event content animation can become stuck between classes and glitch out. Can not fix as it relies on the `animationend` event, which doesn't always get fired, presumably the cause of the issue.
197+
198+
- IE11 and Safari 5.1.7 for Windows 10 both have issues with the timeline, and encounters errors. Will not fix due to the browsers being severely outdated and their dev console errors are lacking descriptions to even attempt to find the cause of the errors.
199+
200+
## Deprecated
201+
All the following options are deprecated and will be removed in version 2.0.6!
202+
203+
As of _v2.0.5-alpha.3_ ...
204+
- `data-date`
205+
- `data-custom-display`
206+
207+
(In favour of the combined singular data attribute: `data-horizontal-timeline` with key:value pairs.)
208+
209+
As of _v2.0.5.1_ ...
210+
- `desktopDateIntervals`
211+
- `tabletDateIntervals`
212+
- `mobileDateIntervals`
213+
- `minimalFirstDateInterval`
214+
- `iconBaseClass`
215+
- `scrollLeft_iconClass`
216+
- `scrollRight_iconClass`
217+
- `prev_iconClass`
218+
- `next_iconClass`
219+
- `pause_iconClass`
220+
- `play_iconClass`
221+
- `animation_baseClass`
222+
- `enter_animationClass` object
223+
- `exit_animationClass` object
224+
225+
(In favour of object options and a combined nested object for the `animationClass`.)

To_Do.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
- ~~Add support for custom slide animations/transitions using Animate.css~~
44
- ~~Implement a namespaced object data attribute to accomodate the data-date and possibly the custom animations.~~
5-
- ~~Add method to dynamically change existing dates and reposition them to reflect their new date order.~~ Will not add due to being an overkill feature.
6-
- ~~Add support for Right-to-Left.~~ (In the form of `dateOrder: reverse`.)
5+
- ~~Add method to dynamically change existing dates and reposition them to reflect their new date order.~~
6+
7+
Will not add due to being an overkill feature.
8+
- ~~Add support for Right-to-Left.~~
9+
10+
(In the form of `dateOrder: reverse`.)
711
- ~~Rename the disableButton to reflect the docs name of Inactive Button States.~~
8-
- ~~Rework Autoplay to allow multiple autoplaying timelines per page.~~ Can not get this to work properly.
12+
- ~~Rework Autoplay to allow multiple autoplaying timelines per page.~~
13+
14+
Can not get this to work properly.
15+

Version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.0.5.1

changelog.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,59 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
- ## 2.0.5.1 [[v2.0.5.1]](https://github.com/yCodeTech/horizontal-timeline-2.0/tree/v2.0.5.1) - 09/04/2020
6+
### Removed
7+
- An unnecessary development console log in the goTo method in the minified file (.min.js)
8+
- The use of `tinyMobile` and `smallTablet` in the CSS media queries.
9+
- The use of `tinyMobile` and `smallTablet` in the `checkMQ` function and various if statements due to being redundant.
10+
11+
### Fixed
12+
- A bug that was caused by a missing `event` parameter in a function declaration when triggering a fake click on the autoplay pause button, it would spit out the error **Cannot read property 'preventDefault' of undefined**.
13+
- The `.on` function relating to that of the timeline navigation which was inadvertently being run when the pause/play buttons were clicked or triggered - adding a `:not` CSS selector to exclude the buttons.
14+
- A bug that appeared after the previous bug fixtures above was implemented. The pause/play `.on` function (`changeButtons`) would now refresh the page, so a `event.preventDefault();` was added.
15+
- An issue with the autoplay pause and play functions, that wouldn't get the instance correctly.
16+
- A bug where the new autoplay prototype function would throw an error when the autoplay `isPaused` and `mouseEvent` data is being set to the element data object because the data object wasn't created at that point (throwing an `undefined` error). Solved by adding it in the plugin wrapper instead of the internal function.
17+
- A bug with the goTo timeline links where if any of the data options were omitted from the links, the function didn't utilise the default options. This was caused by inconsistent naming and the name changes that occured wasn't reflected in the variable declarations, thereby throwing an `unrecognised` error.
18+
- A bug where on first load or hard-reload, the page would have 2 scrollbars due to both the `HTML` and `body` having the `overflow-x: hidden` CSS attribute. Fixed by removing the `HTML` from the CSS rule.
19+
20+
### Changed
21+
- The jQuery options `$.extend` to deep nested recursion with the `true` boolean. Enables the possibility of deep nested objects in the options.
22+
- Added a way to internally access the user options.
23+
- Various code to check if the new object options is set in the user options, if so use them, otherwise use the deprecated single options.
24+
- The `animationClass` options objects and combined them into one nested object.
25+
- The internal function structure to a prototype object of functions, so it only adds the functions to the prototype once.
26+
- The anonymous functions of `init.addIdsAndClasses`, `create.date`, `create.eventDateDisplay`, and `autoplay`; and added them to the timeline prototype as separate functions `_addIdsAndClasses`, `_createDate`, `_eventDateDisplay`, `_autoplay`.
27+
- The `create` function to put together the HTML in a variable before adding to the document, avoiding the obsessive use of the jQuery `.append()`.
28+
- The name of the event data `element` to `timelineSelector` of the `initialised` DOM event, to make it more obvious what is is - `element` could refer to any part of the timeline, where as `timelineSelector` would be more specific.
29+
- The `mobile` and `tablet` CSS media queries widths to include the missing widths accordingly.
30+
- The object options code so if no options are defined or both the single and the object options are defined, then it defaults to the new object options, otherwise use the deprecated single options.
31+
32+
### Added
33+
- New object options instead of the single options:
34+
- `dateIntervals` with keys `desktop`, `mobile`, `tablet` and `minimal`.
35+
- `iconClass` with keys `base`, `scrollLeft`, `scrollRight`, `prev`, `next`, `pause` and `play`
36+
- `animationClass` with keys `base`, `enter` and `exit`, the latter two are objects with keys `left` and `right`
37+
- Added a new DOM event `initialised` to combat the issue of undefined errors when trying to use the any of the public methods straight after the initialisation code. The errors are caused by the hotfix `setTimeout` in the init function to delay the code so it gets the correct width, which in turn makes everything else delayed. The DOM event will be fired after this delay, indicating the plugin has truly completed.
38+
39+
### Deprecated
40+
- The single options:
41+
- `desktopDateIntervals`
42+
- `tabletDateIntervals`
43+
- `mobileDateIntervals`
44+
- `minimalFirstDateInterval`
45+
- `iconBaseClass`
46+
- `scrollLeft_iconClass`
47+
- `scrollRight_iconClass`
48+
- `prev_iconClass`
49+
- `next_iconClass`
50+
- `pause_iconClass`
51+
- `play_iconClass`
52+
- `animation_baseClass`
53+
- `enter_animationClass` object
54+
- `exit_animationClass` object
55+
56+
(In favour of object options and a combined nested object for the animationClass.)
57+
558
- ## 2.0.5 [[v2.0.5]](https://github.com/yCodeTech/horizontal-timeline-2.0/tree/v2.0.5) - 25/02/2020
659
### Added
760
- 3 new attachable namespaced DOM events: `eventAdded`, `eventRemoved`, `eventChanged` (the latter requested via email and an issue).
@@ -63,7 +116,7 @@ All notable changes to this project will be documented in this file.
63116

64117
### Fixed
65118
- The `useFontAwesomeIcons` option where it wouldn't do anything due to missing code.
66-
- A bug that inconsistently and inaccurately calculates the width of the timeline on init, so the scrolling of the timeline was off slightly. (This was due to the function being called slightly before all elements had to chance to be created). Fixed with a 300s delay.
119+
- A bug that inconsistently and inaccurately calculates the width of the timeline on init, so the scrolling of the timeline was off slightly. (This was due to the function being called slightly before all elements had to chance to be created). Fixed with a 300s `setTimeout` delay.
67120
- A bug that when the buttons are disiabled, the timeline appears to not to have a width and disappeared.
68121
- A persistant bug that shows the horizontal (x) scrollbar when translating the event content, added a line in the CSS.
69122
- A bug that broke multiple timelines by using the nav buttons that stored the wrong timeline instance when TouchSwipe was used.

0 commit comments

Comments
 (0)