I am building a plugin which has a option where a user can set which element should right (default is left), the idea is for an menu, which has the option that a user can say, the first sub menu and the third submenu should float to the right, but i cant seem to get it to work, if i add one value it works, but once i add more values it doesn’t work.
// plugin options
var defaults = {
floatRight: [1,5,6,9]
}
var opt = jQuery.extend(defaults, o);
// the loop
var i = 0
$('li').each(function(){
if((jQuery.inArray(i, o.floatRight)) == '-1'){
// add class...
}
i++;
});
It looks like you want to use
optrather thano?Also, change the comparison to
!==as I’m assuming you want to add the class if it is floated on the right?Example – http://jsfiddle.net/infernalbadger/JL7zx/