Skip to content

Commit 83fbb31

Browse files
authored
Fixed a bug with the methods
Fixed a bug where upon calling the methods, it wouldn't recognise the term `timelineComponents` in a function call, due to encapsulating the term in a private plugin variable rather than the previous global variable, which is not ideal. This meant that the methods wouldn't function. Furthermore, in relating to the Refresh method calling the `addIdsAndClasses` function wouldn't actually do anything, because it didn't know which instance we are relating to, therefore it couldn't get the correct elements.
1 parent b454705 commit 83fbb31

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

JavaScript/horizontal_timeline.2.0.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ Docs at http://horizontal-timeline.ycodetech.co.uk
119119

120120
function addIdsAndClasses(self) {
121121
//** Adding IDs and Classes **//
122+
self._timelineComponents(timelineComponents);
123+
122124
if (timelineComponents['eventsContentList'].length == 1) {
123125
timelineComponents['eventsContentList'].first().attr('id', 'first');
124126
timelineComponents['timelineEvents'].first().addClass("first");
@@ -1174,6 +1176,8 @@ Docs at http://horizontal-timeline.ycodetech.co.uk
11741176
* Use it like: $('#example').horizontalTimeline('refresh');
11751177
*/
11761178
Timeline.prototype.refresh = function () {
1179+
var timelineComponents = {};
1180+
11771181
this._timelineComponents(timelineComponents);
11781182

11791183
// Removes first and last id attributes of the event-content list.
@@ -1237,6 +1241,8 @@ Docs at http://horizontal-timeline.ycodetech.co.uk
12371241
* (new event content html, insertion method (before or after), an existing unique date to position the new content around.)
12381242
*/
12391243
Timeline.prototype.addEvent = function (html, insertMethod, arrangementDate) {
1244+
var timelineComponents = {};
1245+
12401246
this._timelineComponents(timelineComponents);
12411247

12421248
// Get the new date from the HTML.
@@ -1274,6 +1280,8 @@ Docs at http://horizontal-timeline.ycodetech.co.uk
12741280
* Use it like: $('#example').horizontalTimeline('removeEvent', '01/01/2001');
12751281
*/
12761282
Timeline.prototype.removeEvent = function (date) {
1283+
var timelineComponents = {};
1284+
12771285
this._timelineComponents(timelineComponents);
12781286

12791287
// Select the specified timeline event

0 commit comments

Comments
 (0)