1

I have a pane that it part of a set of panes created using the plugin jQuery UI Layout.

This pane has a "toggle" button with a certain height and width (I made it an obnoxious value just to demonstrate).

$('body').layout({
    applyDefaultStyles: true,
    east: {
        spacing_closed: 100, //toggler width
        spacing_open: 100,
        togglerLength_closed: 200, //toggler height (length)
        togglerLength_open: 200,
    }
});

I was wondering if / how I can modify the settings of that toggle button or anything else for that matter after the layout has already been instantiated. For example, on button.click(), I might want to set it's height/width to 0 so that the user cannot interact with it.

In my JS Fiddle I can access the layout and toggle a pane "Open" or "Closed" in a click handler function. However, I can't seem to change the attribute of it after it has been instantiated. Does anyone know how to do this?

Fiddle: http://jsfiddle.net/c92whe17/6/

AlbatrossCafe
  • 1,710
  • 6
  • 26
  • 49
  • is their any particular reason as to why you aren't using css directly for this (.classname)? Or changing the elements' attributes directly (width and position) . It just seems to me you're going about it a bit overlycomplicated.... but that's just me. As for your question, I can't think of any way to change those directly. – Spacemonkey Jul 27 '15 at 19:27
  • I was thinking of doing it as a backup but didn't know if this plugin had something built in for this that would be a little bit less messy I guess – AlbatrossCafe Jul 27 '15 at 19:28
  • 1
    looking at your js fiddle code, (this might not be the reason), it seems to me you are modifying your spacing value but nothing is being refreshed on the element (understandably) however if you call toggle again youll be re-overwriting your new value with the one hardcoded in your toggle. Try making one function to instantiate your element and then functions to have it move. THEN try modifying its values and callign the moving functions. (having one that simply repositions it could be good) - anyway, thats what I'd try – Spacemonkey Jul 27 '15 at 19:34

1 Answers1

2

You were close. You can do:

testLayout.options.east.spacing_open = 20;

It doesn't update the UI until you toggle it though unless you can find some refresh method, so I'm just toggling it twice.

http://jsfiddle.net/jc3rj681/

Chase Rocker
  • 1,908
  • 2
  • 13
  • 14
  • thanks! I'll look around to see if I can find a refresh, though to be honest just toggling twice is probably good enough! – AlbatrossCafe Jul 28 '15 at 00:29