javascript - Initialize jQuery Plugin property with a function instead of a static property? -


i initialize jquery plugin function instead of static property.
works this:

$("#sliderprice").slider({     step: 1,     smooth: true,     limits: false,     scale:  ['24h', '48h', '3 days', '1 week'] }); 

what i'm trying this:

$("#sliderprice").slider({     step: 1,     smooth: true,     limits: false,     scale:  function(){ return custom array; } }); 

is somehow possible?
i'm using slider egor khmelev.

you can self-invoke function without modifying original code:

$("#sliderprice").slider({     step: 1,     smooth: true,     limits: false,     scale:  (function(){        return [5,4,3,2,1];     }()) }); 

you can within self-invoking anonymous function. create, modify or map existent array , return it. outer parenthesis aren't necessary, it's convenient way tell looking @ code, going on there.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -