|
53 | 53 | // pass this object as argument multiple times.
|
54 | 54 | function mergeOptions(timer, opts) {
|
55 | 55 | opts = opts || {};
|
| 56 | + |
| 57 | + // Element that will be created for hours, minutes, and seconds. |
| 58 | + timer._options.elementContainer = opts.elementContainer || 'div'; |
| 59 | + |
56 | 60 | var classNames = opts.classNames || {};
|
57 | 61 |
|
58 | 62 | timer._options.classNameSeconds = classNames.seconds || 'jst-seconds'
|
|
66 | 70 |
|
67 | 71 | var that = this;
|
68 | 72 |
|
69 |
| - var createSubDivs = function(timerBoxElement){ |
70 |
| - var seconds = document.createElement('div'); |
| 73 | + var createSubElements = function(timerBoxElement){ |
| 74 | + var seconds = document.createElement(that._options.elementContainer); |
71 | 75 | seconds.className = that._options.classNameSeconds;
|
72 | 76 |
|
73 |
| - var minutes = document.createElement('div'); |
| 77 | + var minutes = document.createElement(that._options.elementContainer); |
74 | 78 | minutes.className = that._options.classNameMinutes;
|
75 | 79 |
|
76 |
| - var hours = document.createElement('div'); |
| 80 | + var hours = document.createElement(that._options.elementContainer); |
77 | 81 | hours.className = that._options.classNameHours;
|
78 | 82 |
|
79 |
| - var clearDiv = document.createElement('div'); |
80 |
| - clearDiv.className = that._options.classNameClearDiv; |
| 83 | + var clearElement = document.createElement(that._options.elementContainer); |
| 84 | + clearElement.className = that._options.classNameClearDiv; |
81 | 85 |
|
82 | 86 | return timerBoxElement.
|
83 | 87 | append(hours).
|
84 | 88 | append(minutes).
|
85 | 89 | append(seconds).
|
86 |
| - append(clearDiv); |
| 90 | + append(clearElement); |
87 | 91 | };
|
88 | 92 |
|
89 | 93 | this.targetElement.each(function(_index, timerBox) {
|
|
119 | 123 | that.startCountdown(timerBoxElement, { secondsLeft: timerBoxElement.data('timeLeft') });
|
120 | 124 | });
|
121 | 125 |
|
122 |
| - createSubDivs(timerBoxElement); |
| 126 | + createSubElements(timerBoxElement); |
123 | 127 | return this.startCountdown(timerBoxElement, options);
|
124 | 128 | }.bind(this));
|
125 | 129 | };
|
|
0 commit comments