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)
  • You must be logged in to reply to this topic.

Register

You will be emailed a link to set your password.

Login

Lost password?