|
400 | 400 | */
|
401 | 401 | IAS.prototype.destroy = function() {
|
402 | 402 | this.unbind();
|
| 403 | + |
| 404 | + this.$scrollContainer.data('ias', null); |
403 | 405 | };
|
404 | 406 |
|
405 | 407 | /**
|
|
547 | 549 |
|
548 | 550 | this.each(function() {
|
549 | 551 | var $this = $(this),
|
550 |
| - data = $this.data('ias'), |
| 552 | + instance = $this.data('ias'), |
551 | 553 | options = $.extend({}, $.fn.ias.defaults, $this.data(), typeof option == 'object' && option)
|
552 |
| - ; |
| 554 | + ; |
553 | 555 |
|
554 | 556 | // set a new instance as data
|
555 |
| - if (!data) { |
556 |
| - $this.data('ias', (data = new IAS($this, options))); |
| 557 | + if (!instance) { |
| 558 | + $this.data('ias', (instance = new IAS($this, options))); |
557 | 559 |
|
558 |
| - $(document).ready($.proxy(data.initialize, data)); |
| 560 | + $(document).ready($.proxy(instance.initialize, instance)); |
559 | 561 | }
|
560 | 562 |
|
561 | 563 | // when the plugin is called with a method
|
562 | 564 | if (typeof option === 'string') {
|
563 |
| - if (typeof data[option] !== 'function') { |
| 565 | + if (typeof instance[option] !== 'function') { |
564 | 566 | throw new Error('There is no method called "' + option + '"');
|
565 | 567 | }
|
566 | 568 |
|
567 | 569 | args.shift(); // remove first argument ('option')
|
568 |
| - data[option].apply(data, args); |
569 |
| - |
570 |
| - if (option === 'destroy') { |
571 |
| - $this.data('ias', null); |
572 |
| - } |
| 570 | + instance[option].apply(instance, args); |
573 | 571 | }
|
574 | 572 |
|
575 |
| - retval = $this.data('ias'); |
| 573 | + retval = instance; |
576 | 574 | });
|
577 | 575 |
|
578 | 576 | return retval;
|
|
0 commit comments