Start a new discussion

To start a new discussion please visit the discussions section of the GitHub home page of the project.

Discussions on GitHub

You can also search our old self-hosted forums for any useful information below but please note that posting new content here is not possible any more.

Reply To: How to set option after initialization

Home Forums Older releases 0.9.x How to set option after initialization Reply To: How to set option after initialization

#2550
admin
Keymaster

Changing some options at runtime (like “subIndicators”) will not have any effect since they are only used at init so these options need to be passed on the init call. But, of course, it’s not a problem to change others (e.g. “showTimeout”, “showOnClick”, etc.) and you can do it like this:

$('#main-menu').data('smartmenus').opts.optionName = newValue;

So if you have the #my-button button, you can do it onclick with the following code:

$('#my-button').click(function() {
	$('#main-menu').data('smartmenus').opts.optionName = newValue;
	return false;
});