我正在使用 Porto 的自定义 JQuery Bootstrap 向导,我被要求在使用链接时,它将在向导的相关选项卡上。
我唯一需要的是从以下对象变量中检索所有属性:
$('#w3').bootstrapWizard({
tabClass: 'wizard-steps',
nextSelector: 'ul.pager li.next',
previousSelector: 'ul.pager li.previous',
previousLinkSelector: 'ul.pager li.finish a.previous-link',
firstSelector: null,
lastSelector: null,
onNext: function (tab, navigation, index, newindex) {
var validated = $('#w3 form').valid();
if (!validated) {
$w3validator.focusInvalid();
return false;
}
},
onTabClick: function (tab, navigation, index, newindex) {
if (newindex == index + 1) {
return this.onNext(tab, navigation, index, newindex);
} else if (newindex > index + 1) {
return false;
} else {
return true;
}
},
onTabChange: function (tab, navigation, index, newindex) {
var $total = navigation.find('li').size() - 1;
$w3finish[newindex != $total ? 'addClass' : 'removeClass']('hidden');
$('#w3').find(this.nextSelector)[newindex == $total ? 'addClass' : 'removeClass']('hidden');
},
onTabShow: function (tab, navigation, index) {
var $total = navigation.find('li').length - 1;
var $current = index;
var $percent = Math.floor(($current / $total) * 100);
$('#w3').find('.progress-indicator').css({ 'width': $percent + '%' });
tab.prevAll().addClass('completed');
tab.nextAll().removeClass('completed');
}
});
我需要把它放在一个全局变量中,这样我就可以使用所有属性(尤其是 onTabClick 属性)。
我试图通过以下方式做到这一点:
var $mainSettings = $.fn.bootstrapWizard;
问题是 $mainSettings 仅包含函数声明。
从 $.fn.bootstrapWizard 获取所有属性的正确方法是什么??