2012-11-15 27 views
0
(function($, window) { 

    $.fn.slideInterval = function(options) { 


    return this.each(function() { 

     $(this).css({overflow: "hidden"}) 

     var slider = { 
      self: this, 
     init:function(options, elem) {     
      self.elem = elem; 
      self.$elem = $(elem); 
      slider.action() 

     }, 
     action:function() { 
      slider.moved.call(slider.self) 
     }, 

     moved:function() { 

       console.log(options.fade) // options.fade is undefined 

     } 

    } 

    slider.init(options, this); 
    }); 
}; 

    $.fn.slideInterval.options = function() { 
    var options = $.extend({ 
     fade: 5, 
     ImgSlide: null, 
     interval: null, 
     bullet: 'default', 
     context: 'Your Title' 
    })(options); 

    }; 


})(jQuery, window); 

我有一些问题,当我调用slider.fade内滑块方法,但不起作用。如何获得滑块对象方法内的选项对象属性.....?jquery插件将属性传递给另一个对象不起作用

.............................................. .................................................. .................................................. .......

回答

0

我觉得要你想要的是,当你调用slideInterval延长传递options对象,但我不知道,因为你没有正确地解释你的代码和问题:

(function ($, window) { 

    $.fn.slideInterval = function(options) { 
     // argument default options with passed options 
     options = $.extend({}, $.fn.slideInterval.options, options); 

     return this.each(function() { 
      // ... 
     }); 
    }; 

    $.fn.slideInterval.options = { 
     fade: 5, 
     ImgSlide: null, 
     interval: null, 
     bullet: 'default', 
     context: 'Your Title' 
    }; 

})(jQuery, window); 
相关问题