I'm programming a plugin and I need users to customize it the function and not in an external CSS. I have an object with some default style in it that can be overriden by the users. BUT I need to set the width
and the marginLeft
according to other functions.
So in my experience I would add the default style (given by the user) by passing it in the css method BUT I can't add more strings if not by adding a new line of .css()
method.
Is there a better way to write this code?
var style: {
'position': 'fixed',
'top': 0,
'left': 0,
'bottom': 0
};
$( 'div' ).css( style )
.css({
width: 300,
marginLeft: -300,
});