Change plugin-vars "onBeforeInit"

Change plugin-vars "onBeforeInit"

Hi,

developed my own Image-Carousel which automatic resizes, when the window is resized or in my case when the orientation of a mobile device is changed. Now I want to change to number of displayed slides in Landscape-View, but i dont know how to change my "Setting"-Vars in my Plugin-Call

Here is the basic Code of my Plugin:

  1.     (function($){
  2.         $.fn.didiCarousel = function(settings) {
  3.             var defaults = {
  4.                 displaySlideQty     : 2,
  5.                 moveSlideQty        : 2,
  6.                 delayFadeTime       : 500,
  7.                 delaySteps          : 350,
  8.                 onBeforeInit        : function() {},   
  9.                 onAfterInit         : function() {},
  10.                 onLoaded            : function() {},   
  11.                 onBeforeSlide       : function(direction) {}
  12.             };
  13.                    
  14.             var $this = $(this);
  15.             var settings;
  16.             var maxVisibleItem = settings.displaySlideQty;
  17.     
  18.             var initCarousel = function() {    
  19.                 settings.onBeforeInit();           
  20.                 settings = $.extend({}, defaults, settings);
  21.                            
  22.                 // some JS Code
  23.                
  24.                 settings.onAfterInit();
  25.             }
  26.            
  27.             var refreshCarousel = function() {
  28.                 clearContent();
  29.                 initCarousel();
  30.             }
  31.            
  32.             $(window).resize(function(){
  33.                 refreshCarousel();
  34.             });
  35.            
  36.             $(window).load(function() {
  37.                 settings.onLoaded();
  38.             });
  39.     
  40.             initCarousel();
  41.         }
  42.        
  43.     })(jQuery);


Here is the Code of my Plugin-Call:

  1.     var mySlider = $('#myCarousel').didiCarousel({
  2.         displaySlideQty : 1,
  3.         moveSlideQty    : 1,
  4.         speed           : 500,
  5.                                           
  6.         onBeforeInit:   function() {
  7.             window.onorientationchange = function() {                            
  8.                 alert("ori change start");
  9.                 $.fn.didiCarousel.settings.displaySlideQty = 2;
  10.                 $.fn.didiCarousel.settings.moveSlideQty = 2;
  11.                 alert("ori change done");             
  12.             };                                            
  13.         },
  14.         onAfterInit:    function() {
  15.             // irrelevant JS-Code after initialization
  16.         },
  17.         onBeforeSlide:  function() {
  18.             // irrelevant JS-Code before every slide
  19.         },
  20.         onLoaded:   function() {
  21.             // irrelevant JS-Code after everything is loaded
  22.         }
  23.     });


As you can see I trigger the orientationchange in my "onBeforeInit" function and try to change my Plugin-Settings-Vars. But no matter what I do I get an error and my second alert isnt called. Can somebody tell me how to change my Plugin-Settings-Vars in my "onBeforeInit" Function.