{"id":722,"date":"2022-08-30T15:06:05","date_gmt":"2022-08-30T15:06:05","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/jquery-theme-settings-options-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:06:05","modified_gmt":"2022-08-30T15:06:05","slug":"jquery-theme-settings-options-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/jquery-theme-settings-options-collection-of-common-programming-errors\/","title":{"rendered":"jquery theme settings options-Collection of common programming errors"},"content":{"rendered":"<p>The way you have the plugin set up right now, <code>slideShowShadow.css<\/code> is trying to assign <code>slideshow.opacity<\/code> at loading time and outside the scope of the <code>themeSettings<\/code> function, which means that <code>slideshow.opacity<\/code> will be <code>undefined<\/code>. All you have to do is move the last few lines into the <code>themeSettings<\/code> function so that they&#8217;re run when you apply the plugin to some element by calling <code>$('#your_elem').themeSettings()<\/code>:<\/p>\n<pre><code>(function($){\n  $.fn.themeSettings = function(options) {\n\n    var slideshow = {\n          opacity: '0.5'\n        },\n        settings = $.extend({}, slideshow, options),\n        slideShowShadow = $('#slideShadowTop, #slideShadowBottom, #slideShadowLeft, #slideShadowRight');\n\n    slideShowShadow.css({ \n      opacity: settings.opacity \n    });\n  };\n})(jQuery);\n<\/code><\/pre>\n<p>Note: Your original post referenced an undefined variable (<code>default<\/code>) in the <code>$.extend<\/code> function, which I&#8217;m sure you had intended to be the <code>slideshow<\/code> object.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 21:43:47. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>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&#8217;re run when you [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-722","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=722"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/722\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}