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);

スライダーメソッド内でoptions.fadeを呼び出すと、問題が発生しましたが、機能しません。スライダーオブジェクトメソッド内のオプションオブジェクトプロパティを取得するにはどうすればよいですか.....??

.................................................。 .................................................。 .................................................。 ..。

4

1 に答える 1

0

optionsを呼び出すときに渡されたオブジェクトを拡張することを望んでいると思いますがslideInterval、コードと問題を適切に説明していないため、わかりません。

(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);
于 2012-11-15T03:02:17.870 に答える