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.

How to set option after initialization

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

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2472
    fhickler
    Participant

    How would I set an option after the menu has been initialized? I am using the bootstrap add-on, in case that is relevant.

    But let’s say I initialize the menu and there is a button on the page that, when clicked, I want it to change an option (say set subIndicators to false). What would be the javascript that the button would trigger?

    #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;
    });
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘0.9.x’ is closed to new topics and replies.