|
71 | 71 | typeof options.start === "undefined" || (options.triggerElement = options.start);
|
72 | 72 | typeof options.trigger == "undefined" || (options.triggerHook = options.trigger);
|
73 | 73 |
|
74 |
| - typeof options.offset === "number" || (options.offset = 0); |
| 74 | + typeof options.offset != "undefined" || (options.offset = 0); |
75 | 75 | typeof options.triggerElement === "undefined" || (options.triggerElement = convertToElement(options.triggerElement));
|
76 | 76 | typeof options.triggerElement != "undefined" || (options.triggerElement = this[0]);
|
77 | 77 | optionsArr.push(options);
|
|
291 | 291 | this.$el = $el;
|
292 | 292 | this.from = options.from;
|
293 | 293 | this.to = options.to;
|
294 |
| - this.offset = options.offset; |
295 | 294 | this.axis = options.axis;
|
296 | 295 |
|
| 296 | + this.offset = convertOption(options.offset, this.getElementDimension()); |
| 297 | + |
297 | 298 | typeof options.triggerHook != "undefined" || (options.triggerHook = "100%");
|
298 | 299 | this.triggerHook = convertOption(options.triggerHook, options.axis === Scene.AXIS_X ? windowWidth : windowHeight);
|
299 | 300 | this.triggerElement = convertToElement(options.triggerElement);
|
|
338 | 339 | };
|
339 | 340 | }
|
340 | 341 | else {
|
341 |
| - var maxDuration = this.axis === Scene.AXIS_X ? this.$el.outerWidth() : this.$el.outerHeight(), |
342 |
| - durationPx = convertOption(duration, maxDuration); |
| 342 | + var durationPx = convertOption(duration, this.getElementDimension()); |
343 | 343 | validateDurationPx(durationPx);
|
344 | 344 | this.duration = function () {
|
345 | 345 | return durationPx;
|
346 | 346 | };
|
347 | 347 | }
|
348 | 348 | },
|
| 349 | + getElementDimension: function() { |
| 350 | + return this.axis === Scene.AXIS_X ? |
| 351 | + this.$el.outerWidth(true) : |
| 352 | + this.$el.outerHeight(true); |
| 353 | + }, |
349 | 354 | needsUpdate: function() {
|
350 | 355 | this.updateStart();
|
351 | 356 | this.updateDuration();
|
|
0 commit comments