bootstrap-modal icon indicating copy to clipboard operation
bootstrap-modal copied to clipboard

fit, flow & reposition (clear mess up history)

Open jojosati opened this issue 11 years ago • 2 comments

sorry for previous pull request.

this branch has cleared some messed up historty

and submit only the fit, flow & reposition code.

jojosati avatar Mar 08 '13 02:03 jojosati

Hey @jojosati I took a look at your pull request and saw that you are listening to the change event in order to reapply the layout on the modal. Why do you listen to the change event when that event is fired by input elements? As a user of the fit/flow/reposition features you added am I expected to fire a change event on the modal element when I want it to reapply the layout? If so it seems like I could just call the layout method myself.

Can you clear things up for me?

jordandh avatar Mar 26 '13 21:03 jordandh

I think there are 2 ways to detect the modal size changing.

  • polling, this may consume the processor.
  • programatic trigger, programer will know where and when to do.

When using modal as popup input form, change event can bubble to the modal automaticly.

At first time I am using modal this way, so I choose the change event because it consume less processor than polling.

Example In my form I have a checkbox for "more option" to collapse/expand some less use inputs. Changing state in this checkbox can trigger the modal to checking whether it's size has changed.

modal-form-explain-01

modal-form-explain-02

When using modal as ajax container, need programatic trigger when finish loading and apply data to the modal.

When using modal as interactive content - collapsable, resizable or toggle hide/show some elements. Leave it to programatice trigger.

Change event does some checkings and optimizations before layout invoke,

  1. Wait for a while, (some transition like fade in / fade out needs a bit time to finish)
  2. Checking whether actual modal size differs from last layout called.
  3. Only size change detected will call layout to minimum the screen flicker problem.

jojosati avatar Mar 27 '13 20:03 jojosati