Closed michaelanfield closed 9 years ago
+1
When I created this plugin, it was made for the content having the same size. I agree with you that the issue that you reported should be fixed. My concern is that I am quire not sure how animation during the flip will look when back and front is not the same size. You are more than welcome to contribute.
Cheers!
With different sizes the flip effect is kind of lost, not entirely, but it does not feel the same. Anyway if you comment the height assign operations, then the front and back child adjusts automatically, but the flip container, while not visible, will still take the whole space.
I think this can be fixed. We don't change the size while the content is flipping but once the flip is done then we can adjust the size.
Imho, this can now be easily worked around using new options autoSize
, forceWidth
and forceHeight
. The force*
options are false
by default and if you set autoSize
to false
as well than Flip won't touch anything and you are free to style the front and back faces any way you want from CSS.
@michaelanfield Please reopen this if you still have issues.
Background
We have a component to capture an address (front) and provide look-up functionality. On supplying look-up details we search for matching addresses. This flips the address to display matching addresses (back). Selecting an address flips you back to the address input (front) with the selected address details populated.
Example markup
Issue
The front is not a fixed height and neither is the back. Based on the background I mocked up results in the back panel and configured flip using the manual trigger.
As it stands the output is a container with a height that includes the front and back resulting in a large blank space due to the back now being hidden as shown in the image below.
Analysis
It would appear that the height and width is driven by the element you are performing the flip on (#address in this case). As this has no fixed height or width and the content is not hidden, you get the full height and width of the front and back components.
These values are then also applied to the front and back panels.
Suggestion
Shouldn't the height and width be based on the front panel only. The back panel is hidden and it seems reasonable that the UI should only take up the necessary space required by the front panel. I would imagine something like this;
If you agree that this is an issue I more than happy to create a pull request to include the proposed suggestion.