我正在使用一个标签插件,它允许您为其行为传递默认选项。
$('#responsiveTabsDemo').responsiveTabs({
startCollapsed: 'accordion',
setHash: true
});
在.js文件中:
var defaults = {
active: null,
event: 'click',
disabled: [],
collapsible: 'accordion',
startCollapsed: false,
rotate: false,
setHash: false,
animation: 'default',
animationQueue: false,
duration: 500,
scrollToAccordion: false,
scrollToAccordionOnLoad: true,
scrollToAccordionOffset: 0,
accordionTabElement: '<div></div>',
activate: function(){},
deactivate: function(){},
load: function(){},
activateState: function(){},
classes: {
tabStyle: 'j',
stateDefault: 'j-tabs-state-default',
stateActive: 'j-tabs-state-active',
stateDisabled: 'j-tabs-state-disabled',
stateExcluded: 'j-tabs-state-excluded',
container: 'j-tabs',
ul: 'j-tabs-nav',
tab: 'j-tabs-tab',
anchor: 'j-tabs-anchor ',
panel: 'j-tabs-panel',
accordionTitle: 'j-tabs-accordion-title '
}
};
因此,通过在页面上指定任何这些,我可以覆盖任何默认值。
但是,我想覆盖classes
的一些默认值。我试过了:
$('#responsiveTabsDemo').responsiveTabs({
startCollapsed: 'accordion',
setHash: true,
classes: {
tabStyle: 'r'
}
});
...但这会删除classes
的所有其他值。
如何在不擦除所有其他值的情况下,只将一个值传递给此数组?