jquery theme settings options-Collection of common programming errors

The way you have the plugin set up right now, slideShowShadow.css is trying to assign slideshow.opacity at loading time and outside the scope of the themeSettings function, which means that slideshow.opacity will be undefined. All you have to do is move the last few lines into the themeSettings function so that they’re run when you apply the plugin to some element by calling $('#your_elem').themeSettings():

(function($){
  $.fn.themeSettings = function(options) {

    var slideshow = {
          opacity: '0.5'
        },
        settings = $.extend({}, slideshow, options),
        slideShowShadow = $('#slideShadowTop, #slideShadowBottom, #slideShadowLeft, #slideShadowRight');

    slideShowShadow.css({ 
      opacity: settings.opacity 
    });
  };
})(jQuery);

Note: Your original post referenced an undefined variable (default) in the $.extend function, which I’m sure you had intended to be the slideshow object.

Originally posted 2013-11-09 21:43:47.